Hacker News new | ask | show | jobs
by simplify 2617 days ago
Context IS NOT the most important concept in React. It's basically CSS cascading. Not something you want to introduce into your project so easily.
2 comments

I wouldn't go as far as to say Context is the most important concept in React, but it's also not nearly as bad as CSS cascading.

Context is fully opt in. A Context provider upstream will have no observable effect on your downstream components unless you have a component that explicitly chooses to consume _that particular context_.

I think you're thinking of the old Context API where everything merged onto the same shared context object and read from it implicitly. _That_ was a nightmare, hence why it was never recommended for general use, but the new API doesn't suffer from the same issues.

Yes, theoretically you can ignore props and state, because context could replace both.