Rpirvate Router React

import React from 'react'
import { Route, Redirect, RouteComponentProps } from 'react-router-dom'
import { getAuth } from './utils/storage'

export const PrivateRoute = ({ component: Comp, ...rest }) => (
	<Route {...rest} render={(props: RouteComponentProps<any>) => (!getAuth() ? <Redirect to='/' /> : <Comp {...props} />)} />
)
Restu Wahyu Saputra