DEV Community

Discussion on: How to load a #hash fragment to an anchor name in react (especially in first loading)

Collapse
 
alejomartinez8 profile image
Alejandro Martinez

Thanks for feedback!! Just to say, when I tried it on the project I don't why doesn´t work like

window.addEventListener("hashchange", scrollToHashElement);
return () => window.removeEventListener("hashchange", scrollToHashElement);
Enter fullscreen mode Exit fullscreen mode

But checking it on codeSandbox works perfectly, I changed it.