Actions

Allows you to get a type that represents the actions of a model.

Actions<
  Model extends Object = {}
>

Example

import { Actions } from 'easy-peasy';
import { StoreModel } from './index';

type StoreActions = Actions<StoreModel>;

Typically this would only be useful when using the useStoreActions hook.

import { useStoreActions, Actions } from 'easy-peasy';
import { StoreModel } from './store';

function MyComponent() {
  const addTodo = useStoreActions(
    (actions: Actions<StoreModel>) => actions.todos.addTodo
  );
}

That being said, we recommend you use the createTypedHooks API instead.