trishulio / brewcraft-frontend

0 stars 0 forks source link

Make reducer pure #376

Open cleverpuss opened 2 years ago

cleverpuss commented 2 years ago

Reducer functions must be pure, which means that should only return next state, and shouldn't perform any other effects

slappy commented 2 years ago

Hi @cleverpuss is this for a specific reducer file? or for all the reducers?

cleverpuss commented 2 years ago

I mean the Snackbar reducer. Reducers are allowed to only return the next state and they shouldn't perform any side effects. So, we'd be better make a saga.js in the Snackbar folder and call the toast APIs in that saga.

FYI: In BatchStatus folder, we can directly call the toast APIs in the BatchStatus/saga.js.