Home / Function/ reducer() — react Function Reference

reducer() — react Function Reference

Architecture documentation for the reducer() function in index.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  1860d463_30ac_2faf_33b3_5d227523ee71["reducer()"]
  3a02e121_a575_f687_567f_39a3a9f90904["index.js"]
  1860d463_30ac_2faf_33b3_5d227523ee71 -->|defined in| 3a02e121_a575_f687_567f_39a3a9f90904
  style 1860d463_30ac_2faf_33b3_5d227523ee71 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shell/src/app/EditableProps/index.js lines 28–35

function reducer(state, action: {type: string}) {
  switch (action.type) {
    case 'swap':
      return {foo: state.bar, bar: state.foo};
    default:
      throw new Error();
  }
}

Domain

Subdomains

Frequently Asked Questions

What does reducer() do?
reducer() is a function in the react codebase, defined in packages/react-devtools-shell/src/app/EditableProps/index.js.
Where is reducer() defined?
reducer() is defined in packages/react-devtools-shell/src/app/EditableProps/index.js at line 28.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free