React Hooks Flashcards

(9 cards)

1
Q

useState

A

Simple local state save in component.

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

useEffect

A

Side effects, subscribe, fetch

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

useContext

A

Sharing state between many components without prop drilling.

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

UseMemo

A

Memorizing expensive calculations avoids recalculating them every time you render.

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

useRef

A

Stores values ​​that can be changed between renders, or a DOM reference.

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

useLayoutEffect

A

It fires synchronously after the DOM is updated, before painting on the screen.

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

useCallback

A

Memoizes functions to keep stable references, important when passing handlers as props to child components, especially together with React.memo.

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

useDeferredValue

A

Defers an expensive value, the component keeps responding with the old value until the new one is ready.

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

Promise x Observable

A

Promise delivers one async value once then completes.
Observable emits multiple values over time and can be subscribed, transformed, and canceled.

Pull vs push
Multiple subscribers
Cancelation

Use cases
Promise, single async task, HTTP request once, read file once
Observable, streams, user events, websockets, live data, sequences of async events

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