AreWe

Untitled

Mar 27th, 2021
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const About = ({ isAuthMounted }) => {
  2.   if (isAuthMounted) {
  3.     // ...
  4.   }
  5. };
  6.  
  7. const Auth = ({ setAuthMounted }) => {
  8.   useEffect(() => [setAuthMounted(true), () => setAuthMounted(false)], [setAuthMounted]);
  9. };
  10.  
  11. const Parent = () => {
  12.   const [isAuthMounted, setAuthMounted] = useState(false);
  13.   return (
  14.     <>
  15.       <Route path="/about" component={About} {...{ isAuthMounted }} />
  16.       <Route path="/auth" component={Auth} {...{ setAuthMounted }} />
  17.     </>
  18.   );
  19. };
Advertisement
Add Comment
Please, Sign In to add comment