Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are a lot of gotchas with these. Don't call in conditionals, branches, loops. Can only be called from function components. Order of invocation matters (yeck!)

If the goal is helping developers "fall in to the pit of success" I think classes are a much better option than this.



There are a lot of gotchas with the object-oriented way of doing these things too. Don't set `this.state` directly, don't forget to keep your side effect logic in `componentWillMount` parallel to your cleanup logic in `componentWillUnmount`, et cetera.


Yep, no doubt. The problem is they aren't getting rid of old foot guns, just adding new ones. And the new way with hooks isn't obviously superior to the old way (debatable to be sure, but with all the constraints hooks are not a broadly applicable solution to many problems). So now you've got two separate but equally powerful guns pointed at your feet.

Is that progress? I'm too old to think so.


Inl don't understand why they don't use a second parameter to mark the calls.


If you don’t put this in conditional, branches or loops, by definition they will always be called in the same order.


yep I see nothing wrong with classes, infact I think I'm going to go back to an older build of React. All this suspense, the messy fiber rewrite and all is just screwing up library.

LONG LIVE class based component, there was nothing wrong with them. Don't fix it if ain't broke.


Good thing then that, as the page says, "There are no plans to remove classes from React.".


If an older version of react is the goal, maybe infernoJS would be the ticket. It's way more performant than most versions of React while being mostly API compatible (not sure about the most recent react changes).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: