import React,{Component,} from 'react';
import {Route,Redirect} from 'react-router-dom';
export default class PrivateRoute extends React.Component{
constructor(){
super()
}
render(){
const {component, authed, ...rest}=this.props;
return(
<Route
{...rest}
render={(props) => authed === true
? <Component {...this.props} />
: <Redirect to={{pathname: '/login', state: {from: props.location}}} />} />
)
}
}
Error:ReactComponent(...): No render method found on the returned component instance: you may have forgotten to define render.
<Component {...this.props} />is not a validcomponentyou need to create a new component class with a render method and put that there instead.