Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Yet another side effect layer for Redux

Yet another side effect layer for Redux

Avatar for Daisuke Mino

Daisuke Mino

April 24, 2018
Tweet

More Decks by Daisuke Mino

Other Decks in Programming

Transcript

  1. ͜Μͳ͔Μ͡ 1 fork('ORDER', async (action, dispatch) => {¬ 2 dispatch({

    type: 'USER_FETCH', action.payload.userID })¬ 3 const { payload } = await merge('USER_FETCHED')¬ 4 const resp = await fetch(`/api/orders`, {¬ 5 method: 'POST',¬ 6 body: JSON.stringify({ productID: action.payload.productID }),¬ 7 })¬ 8 dispatch({ type: 'ORDERED', payload: JSON.parse(resp.body) })¬ 9 })