3 ms·
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?
by 3vidence 4y ago
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?
- phailhaus 4y agoYeah, 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.
- dragonwriter 4y ago> 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.