Storing the top as a state key is probably better, but to use React.createRef() is also an alternative to getElementById.
Thank you both! I've made some changes on the nav id and how I manage the CSS too.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.