question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Managing large stores

See original GitHub issue

Hey, I was wondering if there is a go-to solution how to manage large stores. In redux this would’ve been done by combining reducers. the combineActions function is useful but it keeps the actions at top level and doesn’t allow for splitting the global application state into smaller chunks. If this is already possible, maybe adding it to the readme would be a good idea.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
neurosnapcommented, Aug 7, 2018

I think the idea is that an action would only have access to one slice of the state as opposed to the entire state. In redux this is accomplished by composing multiple reducers where each reducer is only responsible for one slice (top-level key in state object) and can only access its own slice of the state when reducing.

import { combineReducers } from 'redux';
const user = (state = {}, action) => action.payload;
const todos = (state = [], action) => action.payload;

const rootReducer = combineReducers({
  user,
  todos,
});

the user reducer cannot access todos and vice-versa.

The reason why this might be favorable is to ensure that one action does one thing and one thing only. Theoretically if one action can access/modify the entire state, I could create an action that modifies everything which could have unintended side-effects and arguably be less maintainable over time.

https://redux.js.org/recipes/structuringreducers/splittingreducerlogic

By forcing reducers to only be able to modify one slice of the state, we force developers to think about the problem they are trying to solve before overwriting majors parts of the application with one action/reducer.

0reactions
ernaneluiscommented, Sep 3, 2019

still open to discussing this? I think without the scope state, things can get messed up very easily over time

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Manage a Retail Store for Success in 2023
1 Build & Maintain a Great Team · 2 Manage Your Inventory · 3 Create Data-Driven Sales Goals · 4 Establish Store Procedures...
Read more >
5 Tips for Managing Retail Operations at Your Store
5 Tips for Managing Retail Operations at Your Store · 1. Keep the Interest Alive · 2. Pay Attention to Your Customers ·...
Read more >
Managing Large Retail Stores - Videos & Lessons - Study.com
Any retail employee will require extensive knowledge of the best strategies and elements of managing large retail stores. HR departments can use the...
Read more >
Tips for Effectively Managing a Retail Store - Indeed
Managing a retail store requires a wide range of skills. Stores must be efficiently staffed and stocked, employees should be helpful and committed...
Read more >
Retail Store Management: How to Keep Your Shop Running ...
Support and motivate your staff · Proactively contribute to smooth retail ops and growth · Implement and take advantage of the right tools...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found