Keep the logic out of your React components
Figuring out where to put the "business logic" in a React application can get a bit messy, especially unit testing it. useEffect
functions can quickly turn your components into spaghetti, and state libraries such as Redux can get quite verbose to type out as your application grows. In both of these examples, asynchronous work loads can also be tedious to properly handle.
xLogic tries to strike a middle-ground, keeping the simplicity & modularity of useEffect
hooks, but outside of the component itself like in a state management library, all the while being async & unit testing friendly.
npm install --save xlogic
...
MIT © itsjoekent