Amy Blankenship
1 min readMay 22, 2023

--

My point is that the mechanisms that allow hooks and signals to work without developers' explicity wiring them up are singletons doing spooky things at a distance in the background.

I'd push back on you that Redux might not be a global variable, but it definitely allows components to go get their dependencies without having those dependencies explicitly shown in the component's interface. And typically it is used as a global variable. The old mapStateToProps/mapDispatchToProps at least kept that knowledge out of the component itself--it was still hidden at some level, but from the parent of the wrapper--and that really was the best that could be done because React doesn't give a way to grab components as they are instantiated and inject their dependencies in at that point, which is what we'd need to be able to do this right. And I don't see that happening with the push to Server components, which is going to really confuse things.

--

--

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)