title: Why smooth scrolling is not working on NextJs
body: <p>I found a script that would make smooth scrolling work on <code>next.js</code>.</p>
  
  <p>Here's the repo:
  <a href="https://gist.github.com/vinaypuppal/b7271ad84a0d69c9cfafaaa83afed199" rel="nofollow noreferrer">https://gist.github.com/vinaypuppal/b7271ad84a0d69c9cfafaaa83afed199</a></p>
  
  <p>I added all those required, and also add that change that the first comment suggested. But still as same as using <code>react/link</code>.</p>
  
  <p>The problem is that it's not even calling this code:</p>
  
  <pre><code>  //#LinkSmoothScroll.js
    //...
  
    linkClicked(e) {
      e.preventDefault()
      Router
        .push(this.props.href)
        .then(() =&gt; {
          console.log('test') //this one is not being called at all when I click the &lt;LinkSmoothScroll&gt;
          return smoothScroll(this.props.href)
        })
        .then(() =&gt; {
          this.props.done &amp;&amp; this.props.done()
        })
        .catch(err =&gt; {
          this.props.onError &amp;&amp; this.props.onError(err)
          console.error(err)
        })
    }
  
    //...
  </code></pre>