News for hackers. Stuff that matters.
Re:React I love you, but you're bringing me down by 3vidence on Tuesday September 20, 2022 @12:49PM (#32914412)
An issue I have with hooks are the names. "useEffect" is one of my least favorite function name in any library.

What am I using? What is the effect?

Re:React I love you, but you're bringing me down by phailhaus on Tuesday September 20, 2022 @12:53PM (#32914494)
Yeah, it's not great, but that's because it's extremely general purpose. Its name refers to function side-effects. Since you're writing your components functionally, you need to explicitly declare any effects of your function to be run appropriately. Hence: `useEffect`. The names are super generalized because hooks don't necessarily need to render anything; they're just hooks into the React scheduler, so they can even be used to manage connection state if you want.
Re:React I love you, but you're bringing me down by dragonwriter on Tuesday September 20, 2022 @09:40PM (#32919997)
> What am I using?

The effect.

> What is the effect?

The state-modifying (and thus side-effect-producing, or simply “effectful”) function passed as the first argument to useEffect.