title: Unable to retrieve the state from the store after redirection in Redux React JS
body: <p>I am developing a Web application using React JS + Redux. I am new to React. What I am doing now is trying to set the state on one page and then retrieve the state in another page after redirection.</p>
  
  <p>I have a Component called EventListComponent that displays the list of events. Inside that component, I change the state of a reducer calling an event.</p>
  
  <p>This is the reducer function I call.</p>
  
  <pre><code>import * as EditEventActions from '../actions/edit.event.actions';
  
  export default function (state = { }, action){
      switch (action.type)
      {
          case EditEventActions.EVENT_SET_EDITING_EVENT:
          return { ...state, event: action.payload }
  
          default:
          return state;
      }
  }
  </code></pre>
  
  <p>I fire the actions before redirecting to another page like this.</p>
  
  <pre><code>this.props.setEditingEvent(event);
      this.props.history.push({ 
         pathname : '/event/'+ event.id +'/edit'
      });
  </code></pre>
  
  <p>In the new page, I render the component called, EditEventComponent.</p>
  
  <p>This is the definition of the EditEventComponent</p>
  
  <pre><code>export class EditEventComponent extends React.Component{
  
      constructor(props)
      {
          super(props);
  
          alert(this.props.event.id)//cannot retrieve event here
      }
  
  
      render(){
          return (
              &lt;h4&gt;This is the Edit Event component&lt;/h4&gt;
          );
      }
  
  }
  
  
  
  function mapStateToProps(state)
  {
      return {
          event: state.editEvent.event
      };
  }
  
  function matchDispatchToProps(dispatch)
  {
      return bindActionCreators({
  
      }, dispatch);
  }
  
  
  const enhance = compose(withWidth(), withStyles(themeStyles, { withTheme: true }), connect(mapStateToProps, matchDispatchToProps))
  export default enhance(EditEventComponent);
  </code></pre>
  
  <p>As you can see, inside the EditEventComponent I am trying to retrieve the event field of the state which is set in the previous page. But I cannot retrieve it. 
  My questions are</p>
  
  <ol>
  <li><p>Is the state (of the redux store) reset after redirecting to the new page?</p></li>
  <li><p>What is wrong with my code?</p></li>
  <li><p>If what I am doing is not the right approach, what would be the best way to pass an object from one page to another in React Redux?</p></li>
  </ol>
  
  <p>Here is my action</p>
  
  <pre><code>export const EVENT_SET_EDITING_EVENT = "(EVENT) SET EDITING EVENT";
  
  
  export const setEditingEvent = (data) =&gt; ({
      type: EVENT_SET_EDITING_EVENT,
      payload: data
  });
  </code></pre>
  
  <p>Here is the reducer</p>
  
  <pre><code>import * as EditEventActions from '../actions/edit.event.actions';
  
  export default function (state = { }, action){
      switch (action.type)
      {
          case EditEventActions.EVENT_SET_EDITING_EVENT:
          return { ...state, event: action.payload }
  
          default:
          return state;
      }
  }
  </code></pre>
  
  <p>I expose the EventListComponent in this way as well.</p>
  
  <pre><code>const enhance = compose(withWidth(), withStyles(themeStyles, { withTheme: true }), connect(mapStateToProps, matchDispatchToProps))
  
  export default enhance(EventListComponent);
  </code></pre>