1.0.0 • Published 5 years ago

action-class v1.0.0

Weekly downloads
6
License
ISC
Repository
github
Last release
5 years ago

action-class

You probably shouldn't use this, this is just a personal development tool that I'll probably ditch very soon

the gist

Create actions in a readable way by using the new keyword, actions are intended to be immutable objects, instantiating an action inside of an argument expression clearly conveys this intention (given one knows the dispatcher will never modify an action)

Works especially well with entity classes!

store.dispatch(new CreateTodoItemAction(new TodoItem({name: ''})));

Example inside of a react component

MyComponent = () => {
    
    return (
        <button onClick={}>
    );
}

render(
    <MyComponent />
);