React useReducer hook

    0

    3

    Jose Romero

    reacthookuseReducer•••
    React JavaScript Recipes

    An alternative to useState. Accepts a reducer of type (state, action) => newState, and returns the current state paired with a dispatch method. (If you’re familiar with Redux, you already know how this works.)

    Library: react

    Shortcut: react.hook.reducer.use

    import { useReducer } from "react";
    
    const [state, dispatch] = useReducer(reducer, initialArg, init); 
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.