title: Redux – Reducer depending on other state
body: <p>I have a Redux app that is displaying a list of Properties based on a set of Filters (user input).</p>
  
  <p>Quick description of my state:</p>
  
  <ol>
  <li><code>filters</code> – Filters values object...</li>
  <li><code>properties</code> – Repo of all properties available on page</li>
  <li><code>visibleProperties</code> – List of properties with current filters applied</li>
  </ol>
  
  <p>The problem is when I dispatch &amp; set a new filter value, I need to filter <code>properties</code> based on <code>filters</code> <em>new state</em> and to store the result in <code>visibleProperties</code>.</p>
  
  <p>So I came up with this solution:</p>
  
  <pre><code>export function setBedroomFilter (value) {
    return (dispatch, getState) =&gt; {
  
      // 'SET_FILTER' action
      dispatch(setFilter('bedroom', parseInt(value)))
  
      // New state
      const { filters, properties } = getState()
  
      // 'FILTER_PROPERTIES' action (Depending on new state)
      dispatch(filterProperties(properties, filters))
    }
  }
  </code></pre>
  
  <p>And <code>visibleProperties</code> reducer can do its work:</p>
  
  <pre><code>// case 'FILTER_PROPERTIES'...
  visibleProperties = action.properties.filter(item =&gt; item.bedroom &gt;= action.filters.bedroom)
  </code></pre>
  
  <p>Is this approach totally fine?</p>