React-router-dom not re rendering Switch when state is change
问题 I am using aws-amplify, react-hook in my project. The app have some private Routes has been define below: const ProtectedRoute = ({render: C, props: childProps, ...rest}) => { return ( <Route {...rest} render={rProps => (childProps) ? ( <C {...rProps} {...childProps} /> ) : ( <Redirect to={`/login?redirect=${rProps.location.pathname}${ rProps.location.search }`} /> ) } /> ); } In App.js, we change childProps to define whether user is login or not. But when childProps change, Switch not re