Skip to content

Instantly share code, notes, and snippets.

@Daltonic
Created March 25, 2022 14:42
eCommerce Platform AuthGuard
import { Navigate } from 'react-router-dom'
const AuthGuard = ({ user, children, redirectPath = '/signin' }) => {
if (!user) {
return <Navigate to={redirectPath} replace />
}
return children
}
export default AuthGuard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment