Notes for Codefellows Code 401 301 201 and 102
<Login />
and <Auth />
source It 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 The most common way to access Context from a class component is via the static contextType . If you need the value from Context outside of render , or in a lifecycle method, you’ll use it this way. The traditional way to retrieve Context values was by wrapping the child component in the Consumer
source Themes: setting UX themes; Multilingual applications; Authorization: setting user role and info
source When you have too many nested contexts… This is similar to callback hell. Can be addressed with the ‘React.cloneElement()’ function which returns a new element using the initial ‘element’ as a starting point.
source state which is declared at the app-level.
source Context that 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 component that allows consuming components to subscribe to context changes.
source A React component that subscribes to context changes.
Skim the following materials in preparation for the upcoming lecture. Note the following as you browse the material, and be prepared to participate in discussions during lecture