Attempt refactor to useReducer
Primary feedback from Rune was that I could use useReducer instead of useState.
After a quick look through the docs, it shouldn't be a big refactor as the contents of the reducer function would just be calling existing functions in app-state. Gut feeling after reading the docs is that this will end one of two ways;
- If passing dispatch function into sub-components, the API of the component is then less clear, as it is no longer obvious which actions are dispatched by which component (could I be pleasantly surprised by some type magic here?)
- If passing closures that call dispatch to sub-components then defining actions on top of what I already have will just be an extra layer of boilerplate without much benefit, could perhaps be cleared up by in-lining some of my existing code.
I want to give it a try anyway and see how the code looks, rather than just guessing.
Edited by Jonathan Share