import { useRiducer } from 'riduce'

useRiducer(initialState, riducerDict?)

<aside> <img src="https://miro.medium.com/max/500/1*cPh7ujRIfcHAy4kW2ADGOw.png" alt="https://miro.medium.com/max/500/1*cPh7ujRIfcHAy4kW2ADGOw.png" width="40px" /> useRiducer is the recommended way to use Riduce with React, as a custom hook - but it therefore depends on hooks support (React ≥ 16.8.0), which is given as a peer dependency of Riduce.

</aside>

Function parameters

initialState: any

The initial Tree state of the resultant reducer.

riducerDict (optional): object

TypeScript: RiducerDict (type)

Custom reducer logic: see riducerDict and customRiducer

Return value

An object with three properties:

actions (object)

TypeScript: ActionsProxy (type)

The actions object (for creating actions to be dispatched)

dispatch (function)

TypeScript: React.Dispatch

The dispatch function (for use with the created actions)