Component Lifecycle / useEffect() Hook
-
Why do we not need more .html pages in a multi-page React app?
- In React, all the components are connected to the base index.html file. Instead of creating a brand new page, React only renders the components that is being updated. The multi-page app is actually being rendered in a single page.
-
If we wanted a component to show up on every page, where would we put it and why?
- Inside the
<BrowserRouter />, outside a<Route />
- Inside the
-
What does routing do with the components that were rendered when a new route is requested
- the components in unmounted
-
What does props.children contain?
- it is used to display whatever you include between the opening and closing tags when invoking a component
-
How do useState() and this.setState() differ?
- useState() is a hook function in React used in a function component to use the state functionality and this.setState() is used in class component to reset the state value in that component
Document the following Vocabulary Terms
-
State Hook: special function that lets you “hook into” React features
-
Mounting and Un-Mounting: React performs the cleanup when the component unmounts.