dispatch(myAction('value1', 'value2')); function myReducer(state, action) { switch (action.type) { case 'MY_ACTION': const { var1, var2 } = action.payload; // do something with var1 and var2 return newState; default: return state; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter