Previous Part (adding redux): http://dev.basharallabadi.com/2018/09/part-2-nutracker-reactjs-application.html By default the store only understands object dispatched actions, i.e. it won't support async calls out of the box neither functions, which conflicts with our need to call an api asynchronously and get the results and returns those results to our reducers to update the state. Redux Thunk The simplest approach to achieve what we need is to use something called middleware in redux that can pre process our actions and then proceed to the store when it's done. Redux thunk is a middleware library that knows how to handle a function received as a dispatched action from a component then based on the result it can dispatch more actions to the store to notify our reducers with the results. mainly we use it to process async calls and based on the result (success/fail) we ask it to dispatch the proper actions when. First lets update our foodRepo to actually call an a
Blog about what I try or want to try.. while kids are sleeping !