State as a snapshot Flashcards

1
Q

What does setting state request in React?

A

A new render

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

Where does React store state?

A

Outside of your component, as if on a shelf

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

What does useState provide when called?

A

A snapshot of the state for that render

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

Do variables and event handlers survive re-renders in React?

A

No, every render has its own event handlers

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

What will every render and functions inside it always see?

A

The snapshot of the state that React gave to that render

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

How can you think about state in event handlers?

A

Mentally substitute state in event handlers, similarly to rendered JSX

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

What state values do event handlers created in the past have?

A

The state values from the render in which they were created

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