import React from 'react'; import PropTypes from 'prop-types'; import { Navigate } from 'react-router-dom'; // v6 route guard: rendered as a route `element` wrapping the real page. // Renders its children when authenticated, otherwise redirects to /login. const Authenticated = ({ authenticated, children }) => ( authenticated ? children : ); Authenticated.propTypes = { authenticated: PropTypes.bool.isRequired, children: PropTypes.node.isRequired }; export default Authenticated;