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 }
}}/>
)
)
)}/>
}