0.1.4 • Published 3 years ago

ts-action-creator v0.1.4

Weekly downloads
3
License
ISC
Repository
github
Last release
3 years ago

ts-action-creator

ts-action-creator simple library which will let you create typed actions for reducers.

Install

npm i --save ts-action-creator

Usage Example

import {makeAction} from 'ts-action-creator'

const myTypedAction = makeAction<{value : string}>('MY_TYPED_ACTION_NAME'); // creating action


// will be dispatched as {type : 'MY_TYPED_ACTION_NAME' , payload : {value : 'value'}}
dispatch(myTypedAction({value : "my value"})); 


function reducer(state = {} , action : Action) {
    if(myTypedAction.match(action)) { // Usage in reducer
        return state;
    }
}

Action Properties

createdAction.type // Contains action type
0.1.4

3 years ago

1.0.0

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago