Skip to content

Context API

ALL edited this page Jan 11, 2020 · 1 revision

Context API

  • Context is designed to share data that can be considered “global” for a tree of React components
    • Ex. Current authenticated user, theme, or preferred language
  • Using context, we can avoid passing props through intermediate elements
  • 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

Bookmark

Clone this wiki locally