Context Flashcards

1
Q

What is the purpose of React “context”?

A

to pass states between applications

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

What values can be stored in context?

A

any value that is set by the function or state

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

How do you create context and make it available to the components?

A

export default the context and make it imported on all areas to share the state

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

How do you access the context values?

A

through props with the help of useContext method in React

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

When would you use context? (in addition to the best answer: “rarely”)

A

when you need to share information with other portions of the app when they are not located in the same application

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