MAuse Redirect component from react-router-dom , if user is not logged in redirect him to login page . if you're using local storage for that , you can do it like so { !localStorage.getItem('token') ? <Redirect to="login" /> : <Posts /> } Hope this Help !CommentยทThreadยทAug 6, 2020ยทHow should i implement React authorization inside authentication to protect the one component? any ideas