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

Andy Van Slaars
InstructorAndy Van Slaars

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
~ 3 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 Slaarsinstructor
~ 3 years ago

Sure, that works too :)