Home / Function/ storeReducer() — react Function Reference

storeReducer() — react Function Reference

Architecture documentation for the storeReducer() function in StoreContext.tsx from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f95aed80_4a95_2d5a_4a4b_9e799b10e759["storeReducer()"]
  73168655_c854_d3d1_50a0_b37f865f3c7e["StoreContext.tsx"]
  f95aed80_4a95_2d5a_4a4b_9e799b10e759 -->|defined in| 73168655_c854_d3d1_50a0_b37f865f3c7e
  style f95aed80_4a95_2d5a_4a4b_9e799b10e759 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

compiler/apps/playground/components/StoreContext.tsx lines 89–119

function storeReducer(store: Store, action: ReducerAction): Store {
  switch (action.type) {
    case 'setStore': {
      const newStore = action.payload.store;
      return newStore;
    }
    case 'updateSource': {
      const source = action.payload.source;
      const newStore = {
        ...store,
        source,
      };
      return newStore;
    }
    case 'updateConfig': {
      const config = action.payload.config;
      const newStore = {
        ...store,
        config,
      };
      return newStore;
    }
    case 'toggleInternals': {
      const newStore = {
        ...store,
        showInternals: !store.showInternals,
      };
      return newStore;
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does storeReducer() do?
storeReducer() is a function in the react codebase, defined in compiler/apps/playground/components/StoreContext.tsx.
Where is storeReducer() defined?
storeReducer() is defined in compiler/apps/playground/components/StoreContext.tsx at line 89.

Analyze Your Own Codebase

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

Try Supermodel Free