React (intermediate) Flashcards
install React Router with the command:
npm install react-router-dom
The use_____ hook is a feature of React Router that allows you to access URL parameters in your component. It’s particularly useful when you’re working with d____ routes.
The useParams hook is a feature of React Router that allows you to access URL parameters in your component. It’s particularly useful when you’re working with dynamic routes
We define the route rendering a specific note “ex_____ style” by marking the parameter with a colon - :id
We define the route rendering a specific note “express style” by marking the parameter with a colon - :id
this hook allows you to pass state to the next route, which can be useful for sharing data between routes without using global state management.
useNavigate
the _ prop is used to specify the React component that should be rendered when the route’s path matches the current URL.
the element prop is used to specify the React component that should be rendered when the route’s path matches the current URL.
The element prop takes a ___ expression, not just a component reference.
The element prop takes a JSX expression, not just a component reference.
Hooks are like functional m____s that let you create and compose your own abstractions.
Hooks are like functional mixins that let you create and compose your own abstractions.
If you only allow one useState() call per component, you lose the ability of custom Hooks to introduce local s___. Which is the point of custom Hooks.
If you only allow one useState() call per component, you lose the ability of custom Hooks to introduce local state. Which is the point of custom Hooks.
it’s likely that adopting H___s could reduce your b____ size because code using Hooks tends to m____ better than equivalent code using classes.
it’s likely that adopting Hooks could reduce your bundle size because code using Hooks tends to minify better than equivalent code using classes.
Hooks are fully encapsulated — each time you call a Hook, it gets isolated l___ s___ within the currently executing component.
Hooks are fully encapsulated — each time you call a Hook, it gets isolated local state within the currently executing component.
(They’re not a way to share state — but a way to share stateful logic. We don’t want to break the top-down data flow!)
___ serves the same purpose as componentDidMount, componentDidUpdate, and componentWillUnmount in React classes, but unified into a single API.
useEffect serves the same purpose as componentDidMount, componentDidUpdate, and componentWillUnmount in React classes, but unified into a single API.
Hooks don’t work inside c____s. But you can use them instead of writing c____s.
Hooks don’t work inside classes. But you can use them instead of writing classes.
Hooks offer a powerful and expressive new way to reuse f_____ between c______s
Hooks offer a powerful and expressive new way to reuse functionality between components