import React, { PropTypes } from 'react'; import { Route, Redirect } from 'react-router-dom'; const Authenticated = ({ loggingIn, authenticated, component, ...rest }) => ( { if (loggingIn) return
; return authenticated ? (React.createElement(component, { ...props, loggingIn, authenticated })) : (); }} /> ); Authenticated.propTypes = { loggingIn: PropTypes.bool.isRequired, authenticated: PropTypes.bool.isRequired, component: PropTypes.func.isRequired, }; export default Authenticated;