How to use the react-router.withRouter function in react-router

To help you get started, we’ve selected a few react-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ReactTraining / react-router / examples / auth-flow / app.js View on Github external
const Dashboard = React.createClass({
  render() {
    const token = auth.getToken()

    return (
      <div>
        <h1>Dashboard</h1>
        <p>You made it!</p>
        <p>{token}</p>
      </div>
    )
  }
})

const Login = withRouter(
  React.createClass({

    getInitialState() {
      return {
        error: false
      }
    },

    handleSubmit(event) {
      event.preventDefault()

      const email = this.refs.email.value
      const pass = this.refs.pass.value

      auth.login(email, pass, (loggedIn) =&gt; {
        if (!loggedIn)
github guandjoy / redfish / src / react-app / src / application / preferences / LogoutBtn.js View on Github external
const logout = () =&gt; {
    props.history.push("/logout");
    props.handleMenuClick();
  };
  return (
    <div>
      Logout
    </div>
  );
}

LogoutBtn.propTypes = {
  handleMenuClick: PropTypes.func
};

export default withRouter(LogoutBtn);
github ProgressiveMass / legislator-scorecard / src / routes / act / FilterableLegislatorListComponent.js View on Github external
{data.map(this.renderRow)}
            
          
        
      
    )
  }
}

FilterableLegislatorList.propTypes = {
  data: PropTypes.array.isRequired,
  history: PropTypes.object.isRequired
}

export default withRouter(FilterableLegislatorList)
github michellepanzironi / like-a-genius-fullstack / frontend / components / artists / artist_bar.jsx View on Github external
)
  }

  return(
    <div>
      {barBackground}
      <div>
        {barImage}
        {barInfo}
      </div>
    </div>
  );
};

export default withRouter(ArtistBar);
github influxdata / influxdb / archive / access_control / containers / RolePageContainer.js View on Github external
roles={roles}
        allPermissions={buildAllPermissions()}
        databases={databases}
        roleSlug={roleSlug}
        clusterID={clusterID}
        onRemoveClusterAccount={this.handleRemoveClusterAccount}
        onDeleteRole={this.handleDeleteRole}
        onAddPermission={this.handleAddPermission}
        onRemovePermission={this.handleRemovePermission}
        onAddClusterAccount={this.handleAddClusterAccount}
      />
    );
  },
});

export default withRouter(RolePageContainer);
github GuLinux / AstroPhoto-Plus / frontend / src / Sequences / Sequence.js View on Github external
centered={false}
                    trigger={}
                /&gt;
                }
                /&gt;
                
            
        ) : null;
    }
}

const AddSequenceJob = withRouter( ({history, onCreateSequenceJob, sequenceId, trigger, hasFilterWheel}) =&gt; (
     {
        onCreateSequenceJob(...args);
        history.push('/sequences/' + sequenceId + '/items/pending')
    }} /&gt;
))


export const Sequence = ({ sequence, canEdit }) =&gt; sequence ? (
    
        <header size="medium">{sequence.name}</header>
github alan345 / naperg / react / src / components / chat / Chat.js View on Github external
<div>this.openProfile(this.props.chat.author)}&gt;
                    
                  </div>
                )}
              
            }
            title={<b>{this.props.chat.message}</b>}
            subheader={format(parse(this.props.chat.createdAt), 'MM/DD/YYYY hh:mma')}
          /&gt;
        
      
    )
  }
}

export default withRouter(Chat)
github ONEARMY / community-platform / src / pages / SignIn / SignIn.tsx View on Github external
)}
                    
                  
                
              
            
          )
        }}
      /&gt;
    )
  }
}

export default withRouter(SignInPage)