reading-notes

Context API - Behaviors

Hooks and Context example

1. With regard to the React Context API, what does a “provider” do?

The provider exists to provide context to child components, no matter how deeply they are nested.

2. With regard to the React Context API, how would we implement a “consumer” role?

A consumer would be wrapped inside of a provider component to access the data from the provider.

3. Specifically with Context, how are we “wrapping” components to achieve our goals?

Again, we can nest children components within the provider.

1. Consume content from (at least) two more of the Awesome React Context links. After some familiarity with React Context, once again share your takeaways from each:

  1. Takeaway 1: Looking at the ThemeContext link, I now notice that these examples and articles mention abstracting away managing the state of the context from the consumer.
  2. Takeaway 2: I’m looking at a lot of these packages that seem to be centered around simplifying the use of react context. While it’s tempting to try to implement, I feel like I’d be robbing myself of valuable experience and context by skipping out on learning the native implementation, first.

Additional Questions

1. Looking ahead at this module’s course schedule, What do you look forward to learning?

I’m still looking forward to cookies. What are they? How are they useful? How can they be harmful?

2. What are your learning goals after reading and reviewing the class README?

My learning goal for this lecture is to better understand the syntax and implementation of react context.

Things I Want To Know More About

In-class Notes

Previous Reading

Next Reading