Firebase denormalized data vs Redux normalized state?
<p>Given an example nested data below:</p>

<p>(multiple) users</p>

<p>a user has (multiple) trips</p>

<p>a trip has (multiple) days</p>

<p>a day has a date, and (multiple) visits</p>

<p>a visit has a time, and a location</p>

<p>a location has location specific meta data</p>

<p>At each step it's all '1 to Many' relationship except for the end of tree where a location can be shared by different visits/ days/ trips/ users</p>

<p>It looks like <a href="https://github.com/paularmstrong/normalizr" rel="nofollow">normalizr</a> can normalize/ flatten this data for use as Redux state. But what structure should the data take for its copy in Firebase? </p>

<p>Firebase recommends that data should be denormalized and flattened. But doesn't denormalization mean returning a completely nested structure? I'm getting quite confused about pulling things together with Redux and Firebase so any clarification is greatly appreciated.</p>

<pre><code>  users: {
    user_1: {
      trips: {
        trip_1: {
          days: {
            day_1: {
              date: certain_date
              visits: {
                visit_1: {
                  time: certain_time,
                  loc: {
                    id: certain_location_id,
                    ...
                  }
                },
                visit_2: {...},
                ...  
              }
            },
            day_2: {...},
            ...
          }
        },
        trip_2: {...},
        ...
      }
    },
    ...
  }
</code></pre>