1
如何根据条件以正确的方式发送操作: 我做了以下操作,但出现语法错误。如何根据路由器中的条件发送操作
const PrivateRoute = ({ component: Component, ...rest }) => {
<Route {...rest} render={props => (
firebase.auth().onAuthStateChanged((user) => user
?(
store.dispatch(actions.login(user.uid));
<Component {...props}/>
)
:(
store.dispatch(actions.logout());
<Redirect to={{
pathname: '/login',
state: { from: props.location }
}}/>
)
)
)}/>
}