DON’T REVENT THE WHEEL

ScrollSpy in Angular, React or Vue.js

How to implement ScrollSpy without any 3rd party library

$('body').scrollspy({    target: '#navbar',    offset: 80});
<your-component data-spy="scroll" data-target=".navbar" data-offset="50"><nav class="navbar">
<ul class="navbar-nav">
<li><a href="#section1">Section 1</a></li>
<li><a href="#section2">Section 2</a></li>
...
</nav>

<!-- Section 1 -->
<div id="section1">
...
</div>
<!-- Section 1 -->
<div id="section">
...
</div>

Full Stack Developer (specialised in .NET Core, Angular and ReactJS)