Context API - sarahduv-401-advanced-javascript/seattle-javascript-401d32 GitHub Wiki

Context API

What is context?

  • Context provides a way to pass data through the component tree without having to pass props down manually at every level.

When should you use context API?

  • 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.

Before you use context...

  • 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.

Source: https://reactjs.org/docs/context.html