I have following ReactJS code, which work in this way. In scrolling 30px it change header background color on blue and in returning on 0px it became transparent. I think it working good. But my problem is in another thing. I want only it work on my home page ("/"). How can I achieve it?
I try this
backgroundColor: change && useLocation().pathname == "/" ? "blue" : "transparent"
But it's not help me.
In other cases("), as it was originally, let it remain. Please, I need help.