MCPcopy
hub / github.com/statelyai/xstate / reducer

Function reducer

packages/xstate-solid/test/useActor.test.tsx:1912–1918  ·  view source on GitHub ↗
(state: number, event: { type: 'INC' })

Source from the content-addressed store, hash-verified

1910
1911 it('should be able to work with `fromTransition`', () => {
1912 const reducer = (state: number, event: { type: 'INC' }): number => {
1913 if (event.type === 'INC') {
1914 return state + 1;
1915 }
1916
1917 return state;
1918 };
1919
1920 const Test = () => {
1921 const [count, send] = useActor(fromTransition(reducer, 0));

Callers 1

sendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…