I’ve read a great article about using react-router v4 on The Meteor-Chef, and I want to refactor code from JS to JSX in react component Authenticated.js but got an error:
I mean from this code:
const Authenticated = ({ loggingIn, authenticated, component, ...rest }) => (
<Route {...rest} render={(props) => {
if (loggingIn) return <div></div>;
return authenticated ?
(React.createElement(component, { ...props, loggingIn, authenticated })) :
(<Redirect to="/login" />);
}} />
);
to this code:
const Authenticated = ({ component: Component, logginIn, authenticated, ...rest }) => {
return (
<Route {...rest} render={props => {
if (logginIn) return <div />
return authenticated
? <Component {...props} {...rest} loggingIn={loggingIn} authenticated={authenticated} />
: <Redirect to='/login' />
}}
/>
)
}
But I got an exception error in browser: