mauricevancooten / react-anchor-link-smooth-scroll

React component for anchor links using the smooth scroll polyfill.
243 stars 31 forks source link

Support for original onClick handler #3

Closed roborourke closed 6 years ago

roborourke commented 6 years ago

Cheers for publishing this - was having trouble getting anything else working with gatsbyjs.

If an anchor link needs a custom onClick handler for some secondary side effect like updating state in a parent component it's overridden by the smooth scroll handler, this just adds a check and calls the onClick from props if found at the end of the smoothscroll handler.