What is the React Context hell?
Like the callback hell, usual when jQuery was used for everything, the React Context hell is the nasty c...
For further actions, you may consider blocking this person and/or reporting abuse
Exactly. No point digging into internals when you can just import.
This looks way cleaner IMO. Keep it simple and easy to read.
Agree.
Why is it better?
I am wondering this to. It seems like unnecessary complexity and abstraction that makes the code just look messier.
My last article is on this topic dev.to/ivanjeremic/to-use-context-...
Good point to alert context hell!
I simple skip use context, instead works with simple useReducer, and pass down actions and state in props. That way give more simple component, because my component don't have outer dependency - expect props, so easy join together in quite complex app.
You could just use a real state management library instead of context.
For example?
Recoil?
So you don't use react router and have a BrowserRouter in your code? Or if you use CSS in JS solution, you don't have a kind of ThemeProvider? Or you put both in a recoil state?
Ah and you still need the RecoilRoot, a provider.
I could see what you mean, but no we use riot router, don’t do css in js, and use cerebral js, so we have maybe one provider nested out app.
Having a bit too many react contexts was very relatable! Didn't even know the
React.cloneElement API
till now! Thank you!I think I made an even simpler one here - dev.to/jdgamble555/freakin-easy-re..., let me know your thoughts
I wish React could have something like Services of Angular.
You can use mobx if you want some spaghetti 🍝 in your project.
That's pretty neat 🤓
KISS advocates: 👁👄👁