happypoulp / redux-tutorial

Learn how to use redux step by step
3.76k stars 546 forks source link

how would we applying logMiddleware and disgardMiddleware for 09_middleware example? #98

Closed SOSANA closed 8 years ago

SOSANA commented 8 years ago

How would we go about applying the logMiddleware() function to log all actions for the example in 09_middleware?

Also curious how we could apply disgardMiddleware() function to this example as well? I am guessing we would need more actions to disgard? you mention "could selectively discard a few actions while passing others", How is this beneficial? rather than going through each action one at a time every time an action is called it would only apply the action needed?

Can't believe how epic this tutorial has been, after countless tutorials and blogs its finally setting in :+1:

SOSANA commented 8 years ago

figured it out, just need to pass it to add it to applyMiddleware()

const finalCreateStore = applyMiddleware(logMiddleware, discardMiddleware, thunkMiddleware)(createStore)