Full stack developer building things to make life a little easier. Huge fan of JavaScript, React, Node.js, and testing my code. • twitter.com/ZakLaughton • zaklaughton.dev
I'd argue this example is nowhere near needing React context.
I usually hear "prop drilling" refer to excessively and deeply passing props, which I don't think is happening in this example. Passing props is actually preferable to Context here, and in most other use cases. Even if you do want to work around prop drilling, it's best to try applying component composition before reaching for Context, as mentioned in the Context React docs.
Context is useful, but it has trade-offs. It's a workaround; not a default container for all state. It should only be used in specific use cases when you have data you want to access in many parts of your app.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'd argue this example is nowhere near needing React context.
I usually hear "prop drilling" refer to excessively and deeply passing props, which I don't think is happening in this example. Passing props is actually preferable to Context here, and in most other use cases. Even if you do want to work around prop drilling, it's best to try applying component composition before reaching for Context, as mentioned in the Context React docs.
Context is useful, but it has trade-offs. It's a workaround; not a default container for all state. It should only be used in specific use cases when you have data you want to access in many parts of your app.