News for hackers. Stuff that matters.
Re:Frustrations with React Hooks by istoica on Tuesday September 10, 2019 @11:37AM (#20929360)
How are your functions pure if inside them you call `useEffect`, `useState` ? Where is pureness when at first look they generate side effects, or am I missing something ?
Re:Frustrations with React Hooks by s_y_n_t_a_x on Tuesday September 10, 2019 @11:39AM (#20929390)
Not all functions needs hooks, not all hooks break pureness.

But my point was functions are simpler in all those scenarios, pure or not. Edited my comment to reflect that.

Re:Frustrations with React Hooks by csande17 on Tuesday September 10, 2019 @12:14PM (#20929809)
> not all hooks break pureness

Sure, if you define a function called useWhatever that doesn't actually call any hooks, that might be a pure function. But the restrictions described in https://reactjs.org/docs/hooks-rules.html are not restrictions that pure functions have.