Conceptual
Login

useContext Hook

useContext reads the nearest matching Provider's value and subscribes the component: every consumer re-renders whenever that value changes by Object.is. Because a fresh object literal in the Provider's value prop changes identity each render, context values are typically memoized or split (state context vs dispatch context) to contain re-render blast radius.

This Concept is waiting for its first lesson!

useContext reads the nearest matching Provider's value and subscribes the component: every consumer re-renders whenever that value changes by Object.is. Because a fresh object literal in the Provider's value prop changes identity each render, context values are typically memoized or split (state context vs dispatch context) to contain re-render blast radius.

Are you a teacher? Sign in to start contributing.

Sign In