I'm trying to figure out how to set up a reducer for a property in my state tree that gets created from user events.
My state tree looks like this:
{
session: { session object },
dashboard: {
id: 'id001',
charts: {
'cid001': { dimensions: { ... }, more objects... },
'cid002': { dimensions: { ... }, more objects... }
}
}
}
New charts
properties come in through Redux when a user clicks the Add Chart button. The key is set to the chart id, cid
.
I'm currently using combineReducers()
to set up the reducer tree.
import session from './session';
import charts from './charts';
const rootReducer = combineReducers({
session,
dashboard: combineReducers({
charts
});
});
I am able to nest reducers like this if I know the property names ahead of time. However, I'd like to avoid having a massive reducer for the charts
property, since each chart inside it could have up to 20 more objects on it that need reducing, dimensions
is just one example.
Is there a way to set a reducer for the charts['cidxxx'].dimensions
, and other sub-properties? Are there wildcard tokens for this? Any thoughts?
I'm trying to hide the "collapsible" button after it is being pressed. activities.html: <button class="collapsible"> <i class="fa fa-angle-down"></i></a></button> ...
I'm trying to hide the "collapsible" button after it is being pressed. activities.html: <button class="collapsible"> <i class="fa fa-angle-down"></i></a></button> ...
Jest has this feature to log the line that outputs to console methods. In some cases, this can become annoying: console.log _modules/log.js:37 ℹ login.0 screenshot start console.time _modules/...
Jest has this feature to log the line that outputs to console methods. In some cases, this can become annoying: console.log _modules/log.js:37 ℹ login.0 screenshot start console.time _modules/...
How could I change selected option for dropdown list using javascript or jQuery? <select id ="someId" name="someName"> <option>One</option> <option>Two</...
How could I change selected option for dropdown list using javascript or jQuery? <select id ="someId" name="someName"> <option>One</option> <option>Two</...
I have these two strings: "1-2" and "1--2". I would like to have a regex that would match only the first occurrence of the hyphen in both strings, such that the split would then be: [1,2] and [1,-2]. ...
I have these two strings: "1-2" and "1--2". I would like to have a regex that would match only the first occurrence of the hyphen in both strings, such that the split would then be: [1,2] and [1,-2]. ...