title: Can we redirect to in reduxSaga
body: <p>I've a login page with HOC I pass component which must render be after successful login.</p>
  
  <p>Here, if I check for isLoggedIn and redirect in render of sigin-in  for then I get error  </p>
  
  <blockquote>
    <p>err: Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops</p>
  </blockquote>
  
  <p><em>saga.js</em></p>
  
  <pre><code>           try{//call api
                  //put login success
                &lt;Redirect to="/app"/&gt;        
              }
  </code></pre>
  
  <p><em>index.js</em>  </p>
  
  <pre><code>          const AuthProfile=requireAuth(App);
  
             In reactdom
               &lt;Route render={(props)=&gt;&lt;AuthProfile  {...props}/&gt;} path="/app"/&gt;  
  
  
            import React, { PropTypes } from 'react';  
            import { connect } from 'react-redux';  
            import { push } from 'react-router-redux';
            import { bindActionCreators } from 'redux';
  
            export default function (ComposedComponent) {  
              class Authenticate extends React.Component {
  
  
                componentDidMount() {
                  console.log("12ra")
                  this._checkAndRedirect();
                }
  
                componentDidUpdate() {
                  this._checkAndRedirect();
                }
  
                _checkAndRedirect() {
                  const { isLoggedIn, redirect } = this.props;
  
                  if (!isLoggedIn) {
                    redirect();
                  }
                }
  
                render() {
                  console.log("28ra")
                  return (
                    &lt;div&gt;
                      { this.props.isLoggedIn ? &lt;ComposedComponent {...this.props} /&gt; : null }
                    &lt;/div&gt;
                  );
                }
              }
  
              const mapStateToProps = (state) =&gt; {
                return {
                  isLoggedIn:state.signInReducer.isLoggedIn
                };
              };
  
              const mapDispatchToProps = dispatch =&gt; bindActionCreators({
                redirect: () =&gt; push('/')
              }, dispatch)
  
              //Authenticate.propTypes = propTypes
  
              return connect(
                mapStateToProps, 
                mapDispatchToProps
              )(Authenticate);
            }       
  </code></pre>
  
  <p>Is HOC component correct or I'm missing on something?</p>
  
  <p>Is it good practise to redirect in saga?</p>
  
  <p>Can anyone please  lemme know how do I get to app component after success i'm stuck there please help thanks</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><em>saga.js</em></p>
  
  <pre><code>       yield put({type:LOGIN_SUCCESS,payload:data})
          yield put(push('/app'))
  </code></pre>
  
  <p>index.js</p>
  
  <p></p>
  
  <p>Ex for Page1,Page2 I need </p>
  
  <pre><code>        &lt;AuthRoute
        exact
        path="/"
        component={Page1}
        redirectTo="/login"
        authenticated={this.props.isLoggegIn}
      /&gt;
  
       &lt;AuthRoute
        exact
        path="/"
        component={Page2}
        redirectTo="/login"
        authenticated={this.props.isLoggegIn}
      /&gt;
  </code></pre>