fisshy / react-scroll

React scroll component
https://github.com/fisshy/react-scroll/blob/master/README.md
MIT License
4.35k stars 436 forks source link

When "onClick" to close the menu is inserted, the menu does not scroll properly. #563

Open nehiro opened 1 year ago

nehiro commented 1 year ago

Hi. I want to scroll to the id. When it is at the top of the page, it works correctly, but if it is in the middle of the page or press the same link twice, it jumps to the top of the page. Removing the onClick event will do the expected scrolling. import { Link as Scroll } from 'react-scroll'; .... <Scroll onClick={() => setOpen(false)} smooth={true} to={item.to} duration={600} offset={-30}>{item.name}</Scroll>

fisshy commented 11 months ago

Do you a have a codepen/plunkr to demonstrate the issue?