const [load, setLoad] = useState(false); window.onload = function pageLoad() { if (load) { window.location.reload(true); setLoad(false); } };