'A better way to reload() on click in React? Possibly with a useCallback hook?

After many infinite loops, I got the state to work and the page reloads on the click of my own refresh button.

I watched a few useMemo() and useCallback() tuts on Youtube but I haven't used the hooks enough to understand them. I was able to get it working but was wondering if anyone wanted to advise or hint at a better way to proceed...?

Also the useEffect with a variable dependency array didn't work for me though it seemed like the best solution originally.

function NavButtons(props) {
    const [refresh, setRefresh] = useState(false);
    function Refresh () {
        window.location.reload(true);
    }
    return (
        <div>
            <RefreshIcon onClick={Refresh} />         
        </div>
    );
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source