SHARE
TWEET

Untitled

a guest Jun 15th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. import { useAuthDataContext } from "components/auth-provider";
  3. import { Link } from 'react-router-dom'
  4.  
  5. const UserInfo = () => {
  6.   const { user, onLogout } = useAuthDataContext();
  7.  
  8.   if (!user) {
  9.     return <Link to="/">Please log in</Link>;
  10.   }
  11.  
  12.   return (
  13.     <div>
  14.       <p>Hello {user.name}</p>
  15.       <button onClick={onLogout}>Log out</button>
  16.     </div>
  17.   );
  18. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top