Custom Actions

  • You can configure custom actions:

const url = '';
export const {types, actions, reducers} = createResource({
name: 'user',
actions: {
run: {method: 'POST', gerundName: 'running', url: './run'},
merge: {method: 'POST', isArray: true}
  • It will generate the following action creators:

// Action creators available to interact with your REST resource
Object.keys(actions) == ['runUser', 'mergeUsers'];
  • And have the following state by default:

state ==
isRunning: false,
isMerging: false