Updating arrays in state Flashcards

1
Q

What can you put into state?

A

Arrays

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

What should you do instead of mutating an array?

A

Create a new version of it and update the state to it

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

Which syntax is used to create arrays with new items?

A

[…arr, newItem]

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

Which methods can be used to create new arrays with filtered or transformed items?

A

filter() and map()

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

What library can you use to keep your code concise?

A

Immer

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

Fill in the blank: You can use _______ to create arrays with new items.

A

[…arr, newItem]

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

True or False: You can directly mutate an array in state.

A

False

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