const MyProtectedComponent = withAuthenticationRequired(MyComponent); Copy
const MyProtectedComponent = withAuthenticationRequired(MyComponent);
When you wrap your components in this Higher Order Component and an anonymous user visits your component they will be redirected to the login page; after login they will be returned to the page they were redirected from.
Optional
When you wrap your components in this Higher Order Component and an anonymous user visits your component they will be redirected to the login page; after login they will be returned to the page they were redirected from.