- Why do we not need more .html pages in a multi-page React app?
- react app pages re-render to update with new content
- If we wanted a component to show up on every page, where would we put it and why?
- Inside the , because it is the parent router component so the component will render with all child components
- What does routing do with the components that were rendered when a new route is requested
- ignores the other components
- What does props.children contain?
- content between the opening and closing tags of the containing component
- How do useState() and this.setState() differ?
- for useState(), deconstruction is used to define the state's variable and updating function
-
State Hook
- can only be used inside function components, needs to be imported from react, lets you add state to function components, an initial value can be passed into the
useState()parentheses - can declare a new state variable and function to update it via deconstruction:
const [count, setCount] = useState(0);
- source: https://reactjs.org/docs/hooks-state.html
- can only be used inside function components, needs to be imported from react, lets you add state to function components, an initial value can be passed into the
-
Mounting and Un-Mounting
- the
useEffect()hook allows you to use side effects within function components - source: https://reactjs.org/docs/hooks-effect.html
- the