Reading Class 24 - morgan-401-advanced-javascript/seattle-javascript-401n14 GitHub Wiki

Read

context api link

  • 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.
  • Context is primarily used when some data needs to be accessible by many components at different nesting levels. Apply it sparingly because it makes component reuse more difficult.
  • If you only want to avoid passing some props through many levels, component composition is often a simpler solution than context.
  • The defaultValue argument is only used when a component does not have a matching Provider above it in the tree. This can be helpful for testing components in isolation without wrapping them. Note: passing undefined as a Provider value does not cause consuming components to use defaultValue.

Class

Big O?

Bookmark

react context links link