reactjs - how to reduce redux boilerplate -


i'm new redux , find every little thing x turns x_success , x_failure, when fetching data or trying create new entity, , means more action creators, , more handling in reducers. what's recommended approach here? thanks.

recommended approach x_success, x_failure etc. async operations only. let's see why :

async operations in spa operations want know

  1. when operation started,

  2. when got response back

  3. type of response , success or failure

so have seperate actions creator functions return objects , 1 async action creator function can return function instead of object , calls other action creators body.

for reasons above should have seperate action creators, 1 async action creator , of course every action creator should have constant in reducer.

assuming writing constants, actions , reducers in seperate folders, can nightmare. if case, should take @ here duck modular redux .

duck modular redux should definetely implement reduce boilerplate. other things seperate action creators, seperate constants, seperately checking on reducers constants required. there nothing feel bad it.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -