Writing Your Own Actions
const SimpleAction = (state) => [state, effects.none()];Actions with Side-Effects
import { effects } from 'ferp';
const MyEffect = (text) => effects.thunk(() => {
console.log('MyEffect', text);
return effects.none();
});
const IncrementCounterAndPrint = (state) => [
{ ...state, counter: state.counter + 1 },
MyEffect('incremented'),
];Best Practices
Actions import Effects, Effects accept Action parameters
Last updated