import React from 'react'; import { Link } from 'react-router-dom'; import { useAtom } from 'jotai'; import { authAtom, updateAuthAtom } from '../atoms/authAtom'; import { pb } from '../lib/pocketbase'; const Header: React.FC = () => { const [isAuth] = useAtom(authAtom); const [, updateAuth] = useAtom(updateAuthAtom); const handleLogout = () => { pb.authStore.clear(); updateAuth(); }; return (
forum-demo | Kod źródłowy | {isAuth ? ( <> Stwórz post | Profil | ) : ( <> Zaloguj się | Zarejestruj się )}
); }; export default Header; // komponent odpowiedzialny za nagłówek strony