So I decided to use my morning to go over useReducer(). I feel like I’m getting the hang of it!
Anwyays, I decided to seperate out my reducer function and inital state into seperate js files. And then import them to relevant component. This seemed like a clean approach that worked for me as I get pretty overwhelmed by large js files 🥲 Additionally my project could get pretty large and complex.
Out of curiousity…Is there a common approach for setting up useReducer in React projects? Has anyone come across active open source projects using useReducer() that I could take a look at?
submitted by /u/sbos_
[link] [comments]