# Simple Redux with nested state?

**URL:** <https://forum.kirupa.com/t/simple-redux-with-nested-state/637756>\
**Category:** web dev\
**Created:** [January 17, 2018, 9:46pm UTC](https://forum.kirupa.com/t/simple-redux-with-nested-state/637756 "2018-01-17T21:46:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [January 17, 2018, 9:46pm UTC](https://forum.kirupa.com/t/simple-redux-with-nested-state/637756/1 "2018-01-17T21:46:49Z")

</div>

I’m working on a React-Redux conversion of a part of an app with a deeply nested state. It seems the common approach is to use [normalizr](https://github.com/paularmstrong/normalizr) for this, but I’m trying to keep things as simple as possible and the maintain the original format of the state since the devs that will be working on this have little to no knowledge of react or redux so the simpler the better.

Any thoughts on another KISS approach for something like this?

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [January 24, 2018, 5:36pm UTC](https://forum.kirupa.com/t/simple-redux-with-nested-state/637756/2 "2018-01-24T17:36:14Z")

</div>

My original plan, which is what I’m going with for now, was to use lodash’s functional set (see [lodash/fp](https://github.com/lodash/lodash/wiki/FP-Guide)). This can set values in a nested object given a path, returning a new object with only changes made within that path - exactly what is needed for redux.

```javascript
newState = _.set('my.value.path', newValue, origState);

```

The trick is making sure each component dispatching changes within the state has access to the appropriate path (which isn’t tricky so much as just being extra boilerplate).

We’re already using lodash in other places, so that’s not unfamiliar, and this hides most of the intricacies of state immutability within a fairly comprehensible and possibly already familiar api - so long as people remember to use it.
