state value does not change when using useEffect hook

well I have:

const [bgColor, setBgcolor] = useState(false);

and :

useEffect(() => {
    if (window.location.pathname === '/SignUp') {
        setBgcolor(true);
    } else {
        setBgcolor(false);
    }
    console.log(bgColor)
    return () => {
        setBgcolor(false);
    }
}, [])

What I want to do : is when i reload the page or rerender the page i check the current pathname if it is equal to /Signup I set the bgColor to true but here at every time i reload give me false!