News for hackers. Stuff that matters.
Re:useStateMachine: A ½ kb state machine hook for React by jakelazaroff on Saturday May 22, 2021 @10:32AM (#27246876)
My experience is mixed but mostly positive.

- Agreed about useState (and useReducer). They’re simple and they get the job done.

- Agreed about useCallback as well, it’s a lot of boilerplate.

- State in general is a hard problem to deal with, but I’m not sure how hooks in particular encourage it? Class components had the same issue.

- IMO, useEffect is a huge footgun. I understand how it works, I understand how closures work, but it is by far the biggest source of hook-related bugs I’ve experienced.

- This eslint plug-in will solve your dependency list woes: https://www.npmjs.com/package/eslint-plugin-react-hooks

Re:useStateMachine: A ½ kb state machine hook for React by ketzo on Saturday May 22, 2021 @01:26PM (#27248545)
+1 for that eslint plugin, I was just idly wondering if something like that existed earlier this week. Thanks.
Re:useStateMachine: A ½ kb state machine hook for React by jakelazaroff on Saturday May 22, 2021 @03:07PM (#27249389)
Unless your app is peculiar in some way I’d recommend using something like Create React App, which includes it automatically. https://create-react-app.dev