I’ve done this a dozen times. I think you’re right to formalize it. Nice post.
But I tend to agree with some of the comments. One great thing about selectors in redux is the ability to easily derive state. And I think there is still a space for functions that derive react hooks state based on state like data and loading without having to store additional state. This is one reason I’ve been leaning on useReducer, because you can export selectors from the hook, too, since it has access to a whole sub-state object.
I'm a software engineer with a lot of React and startup experience. I write about my opinions on React, using Firebase with React, and lessons from building my 1st startup, Retro.
I’ve done this a dozen times. I think you’re right to formalize it. Nice post.
But I tend to agree with some of the comments. One great thing about selectors in redux is the ability to easily derive state. And I think there is still a space for functions that derive react hooks state based on state like data and loading without having to store additional state. This is one reason I’ve been leaning on useReducer, because you can export selectors from the hook, too, since it has access to a whole sub-state object.
Thank you 🙏🏽