News for hackers. Stuff that matters.
Re:Common Beginner Mistakes with React by localghost3000 on Saturday March 11, 2023 @06:47PM (#35114026)
> I would say useEffect is not an escape hatch, it's a fundamental building block of the hooks paradigm

The react docs literally call it an escape hatch [0]. First sentence.

[0]https://beta.reactjs.org/learn/you-might-not-need-an-effect

Re:Common Beginner Mistakes with React by ojkelly on Saturday March 11, 2023 @07:21PM (#35114587)
Yep, and escape hatch is actually a great descriptor.

useEffect let’s you safely communicate with the world outside react (ie cause side effects). It’s the only reliable way to …escape.

Re:Common Beginner Mistakes with React by phailhaus on Saturday March 11, 2023 @07:21PM (#35114599)
That's funny, they're such a necessary tool for making anything more than simple UI's that I wouldn't consider that an escape hatch. Kind of like saying that screwdrivers are an "escape hatch" for hammers.
Re:Common Beginner Mistakes with React by rhaway84773 on Saturday March 11, 2023 @10:03PM (#35116013)
These are the new Beta docs.

The original docs made no such claim.

Which brings us back to the biggest problem with useEffect. Even the react devs don’t seem to have a clue how it should actually used, until only recently, despite it being among the 2 most used hooks ever since hooks were introduced.

Re:Common Beginner Mistakes with React by localghost3000 on Sunday March 12, 2023 @10:39AM (#35120556)
What about any of that invalidates my assertion that useEffect is not the tool to reach for most of the time?

The original docs are outdated

The abstraction itself is ripe for misuse

Tons of devs use it when they shouldn’t.

Insert shrug emoji here.