bradtraversy / mern_shopping_list

Shopping List built with MERN and Redux
605 stars 436 forks source link

According to Redux docs, reducers should be free of side-effects #28

Open onionpeel opened 5 years ago

onionpeel commented 5 years ago

Brad, Thanks for educating the coding masses! I can't imagine were I would be without having you walk me through the steps needed to build MERN apps.

You have all of the localStorage method calls inside of the reducers. While this works, Redux suggests not producing side-effects from reducers. I put them inside of the action creators (which I think is where they are supposed to be) and things work as expected. https://redux.js.org/glossary#reducer