React (intermediate) Flashcards

1
Q

install React Router with the command:

A

npm install react-router-dom

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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.

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

We define the route rendering a specific note “ex_____ style” by marking the parameter with a colon - :id

A

We define the route rendering a specific note “express style” by marking the parameter with a colon - :id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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.

A

useNavigate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

the _ prop is used to specify the React component that should be rendered when the route’s path matches the current URL.

A

the element prop is used to specify the React component that should be rendered when the route’s path matches the current URL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The element prop takes a ___ expression, not just a component reference.

A

The element prop takes a JSX expression, not just a component reference.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Hooks are like functional m____s that let you create and compose your own abstractions.

A

Hooks are like functional mixins that let you create and compose your own abstractions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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.

A

it’s likely that adopting Hooks could reduce your bundle size because code using Hooks tends to minify better than equivalent code using classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Hooks are fully encapsulated — each time you call a Hook, it gets isolated l___ s___ within the currently executing component.

A

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!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

___ serves the same purpose as componentDidMount, componentDidUpdate, and componentWillUnmount in React classes, but unified into a single API.

A

useEffect serves the same purpose as componentDidMount, componentDidUpdate, and componentWillUnmount in React classes, but unified into a single API.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Hooks don’t work inside c____s. But you can use them instead of writing c____s.

A

Hooks don’t work inside classes. But you can use them instead of writing classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Hooks offer a powerful and expressive new way to reuse f_____ between c______s

A

Hooks offer a powerful and expressive new way to reuse functionality between components

How well did you know this?
1
Not at all
2
3
4
5
Perfectly