score:0

export default function Rendermenu() {

  const [state, setState] = useState({authstate: false})
  const [authState, setAuthstate] = useState(false)

  const authstore = localStorage.getItem("auth");

  useEffect(() => {
    localStorage.getItem('auth')
    console.log(localStorage.getItem('auth'))
  })

  function Setauth() {
    localStorage.setItem('auth', !authState)
    setAuthstate(!authState)
    window.location.reload();
    console.log(authState)
    console.log(localStorage.getItem("auth"));
  }

  function reset() {
    localStorage.clear()
    window.location.reload()
  }


  if(localStorage.getItem('auth')) return (
    <div>
      <SignOut Setauth={Setauth} />
      <button onClick={reset}>clear</button>
    </div>
  );
  return (
    <div>
      <SignIn Setauth={Setauth} />
      <button onClick={reset}>clear</button>
    </div>
  );
}

Related Query

More Query from same tag