0

What’s the difference between “lifting state up” and using Context API?

author
subina kallyani
easy
2
110

Answer
  • Lifting state up: move state to the nearest common parent and pass props down. Best for small scope.
  • Context: avoid “prop drilling” when state needs to be accessed across many deeply nested components. But Context re-renders all consumers on change, so use sparingly for global state (theme, auth, locale).

Click to Reveal Answer

Tap anywhere to see the solution

Revealed

Comments0
    What’s the difference between “lifting state up” and using Context API? - contextapi | EBAT