Skip to content

Instantly share code, notes, and snippets.

@stepankuzmin
Last active June 10, 2017 14:27
Show Gist options
  • Save stepankuzmin/145130f8dd2c486379064d3304e390a5 to your computer and use it in GitHub Desktop.
Save stepankuzmin/145130f8dd2c486379064d3304e390a5 to your computer and use it in GitHub Desktop.
import React, { PureComponent } from 'react';
import { connect } from 'react-redux';
import { Route, Redirect } from 'react-router-dom';
const Main = ({ token }) => {
if (!token) {
return <Redirect to="/login" />;
}
return <div> You are logged in.</div>;
};
const mapStateToProps = (state) => ({
token: state.auth.token
});
export default connect(mapStateToProps)(Main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment