437 karma · joined Sep 19, 2016 (10y ago) · 15 submissions
comment 5y ago · link · parent
See: https://github.com/reduxjs/redux, among others.
The React ecosystem did exactly this for the past few years, but evidently it was decided that a more native approach like hooks were better.
comment 5y ago · link · parent
You can probably build all this infrastructure yourself without hooks and only with plain functions. It'll involve some global store and some subscription mechanism. You'll end up with something really similar to Redux.
comment 5y ago · link · parent
> No idea what this promise chaining thing is that you're talking about.
If you have any asynchronous things going on in `useEffect`, you'll have to do something similar to that `await(0)` song and dance in tests. This specifically affects tests if you do things like update the UI by toggling loading spinners on await.
> Redux
s/Redux/higher order components. One of the motivations for hooks was that as a mechanism for logic composition, HOCs just felt awful to use. (So did render props, which everyone suddenly used for everything in a brief moment of collective insanity.)
> Only a superficial understanding of React
I think there's something in this. The fact is that good or bad, 1) hooks aren't intuitive, 2) hooks have basically doubled React's API surface area. Previously, React was so simple that a backend engineer could pick it up and get productive with it in half a week. That's much less the case these days. I've been onboarding devs to React for years, and these days there's a lot more "yeah, that's magic, you don't need to know how that works for now."
comment 8y ago · link · parent
At least for me, I feel I'd be using this a lot for the boring but common use case of checking for empty arrays and such:
const doSomethingToArr = arr => match (arr) {
[] => whatever,
[x] => whatever,
[x, ...xs] => whatever
}comment 9y ago · link · parent
Looking for frontend developers to help port our existing platforms into an integrated UI build with React and Redux.
Hiring process: coding challenge > phone interview > on-site interview with team.
Contact: thwang@rocketfuelinc.com
Job description: http://app.jobvite.com/m?3GJgqiwS
comment 10y ago · link · parent