reading-notes

These are my reading notes for Code Fellows


Project maintained by taegorov Hosted on GitHub Pages — Theme by mattgraham

Home

<Login /> and <Auth />

The React Context API is a way for a React app to effectively produce global variables that can be passed around. This is the alternative to “prop drilling” or moving props from grandparent to child to parent, and so on. Context is also touted as an easier, lighter approach to state management using Redux. (source)

No.

Themes such as dark mode/light mode, multilingual applications, and setting a user’s role/info (authorization).

(source)

This image summarizes it better than words can:

context-hell

tldr: endless nested context pieces in your app.

This link was used as the source for the image above, and it goes into some solutions to avoid context hell.

Document the following Vocabulary Terms:

To put it simply, global state is the data that is shared between all the components within a React application. When the state is changed, or let’s say a filter is added, the components re-render accordingly. (source)

Context is designed to share data that can be considered “global” for a tree of React components, such as the current authenticated user, theme, or preferred language. (source)

The Provider component accepts a value prop to be passed to consuming components that are descendants of this Provider. One Provider can be connected to many consumers. Providers can be nested to override values deeper within the tree. (source)

A React component that subscribes to context changes. Using this component lets you subscribe to a context within a function component. (source)