MCPcopy Create free account
hub / github.com/testing-library/react-hooks-testing-library / reducer

Function reducer

src/__tests__/useReducer.test.ts:6–7  ·  view source on GitHub ↗
(state: number, action: { type: string })

Source from the content-addressed store, hash-verified

4 runForRenderers(['default', 'dom', 'native', 'server/hydrated'], ({ renderHook, act }) => {
5 test('should handle useReducer hook', () => {
6 const reducer = (state: number, action: { type: string }) =>
7 action.type === 'inc' ? state + 1 : state
8 const { result } = renderHook(() => useReducer(reducer, 0))
9
10 const [initialState, dispatch] = result.current

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…