Modify a Redux Action’s Payload upon Creation with redux-actions

Share this video with your friends

Send Tweet

In this lesson, we’ll use the optional payloadCreator function argument for createAction to transform the raw input into data that is properly formatted for our application.

hkwid
hkwid
~ 6 years ago

How about to implement 'fixCase' like below?

const fixCase = str => `${str.slice(0, 1).toUpperCase()}${str.slice(1).toLowerCase()}`;
Andy Van Slaars
Andy Van Slaars(instructor)
~ 6 years ago

Sure, that works too :)