Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Created April 16, 2019 09:08
Show Gist options
  • Save MeetMartin/e60ed58171852acf8c824ca513cfebf5 to your computer and use it in GitHub Desktop.
Save MeetMartin/e60ed58171852acf8c824ca513cfebf5 to your computer and use it in GitHub Desktop.
// src/store/actions.js
import {types} from '.reducers';
export const useActions = (state, dispatch) => ({
triggerAction: data => dispatch({ type: types.TRIGGER_ACTION, payload: data })
});
@crsanti
Copy link

crsanti commented Apr 21, 2019

Small typo:

- import {types} from '.reducers';
+ import {types} from './reducers';

@enigma1
Copy link

enigma1 commented Oct 19, 2020

How the state argument can be used here? Is there a reason to pass it through?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment