DEV Community

Discussion on: Passing Data Between React Components

zaklaughton profile image
Zak Laughton

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.