INNER CODE UNIT · JavaScript

PrivateRoute

CreateThrive/react-firebase-admin · src/pages/Router/PrivateRoute/index.js:9

const PrivateRoute = ({ path, component: Component }) => {
  const { id } = useSelector(
    state => ({
      id: state.auth.userData.id
    }),
    shallowEqual
  );

  return (
    <Layout>
      <Route
        exact
        path={path}
        render={() => (id ? <Component /> : <Redirect to={paths.LOGIN} />)}
      />
    </Layout>
  );
};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…