Using the older aws-amplify-react, in order to redirect the user to the requested URL after successful login, I had:
<Authenticator
onStateChange={authState => {
if (authState === 'signedIn') {
const { from } = this.props.location.state || {
from: {
pathname: '/',
search: ''
}
};
this.props.history.replace(from.pathname + from.search);
}
}}
/>
From the documentation for the new version (@aws-amplify/ui-react) I see how to access the auth state with the useAuthenticator hook, but no built-in facility to handle changes in this state. Is it not supported and I'm now expected to implement my own change detection?