Amy Blankenship
Jun 21, 2022

--

Incorrect. useContext always has to refer to the specific context instance, and the current context implementation can only manage one value (original could contain whatever you wanted). While you may see passing things through props as "troublesome," it's the only way to create a truly reusable, decoupled component. IDK why people are so terrified of passing things through properties these past couple of years. If you're genuinely that worried about it, create a container one level up to couple to the system and pass from there (but any time you introduce coupling, be prepared for maintainability problems). It's like the react community forgot 30 years of learnings.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (1)