This library will allow you to turn a vanilla javascript website into a spa (Single page app)

to see it in action go to https://tesses.net/spademo.htm

Step 1

in body
<script src="./js/spa.js" defer></script>

Step 2

hrefs
<a href="#index">Home</a> <!-- Note if there is no hash #index page will be shown-->
<a href="#page2">Page 2</a> <!-- #page2 can be anything, as long as it matches the div for corresponding page (the div id doesn't have '#' as seen in step 3) -->

Step 3
<div id="index" class="spapage">
    <!--Home page here-->
</div>
<div id="page" class="spapage">
    <!-- some page -->
</div>

Step 4

Design your spa

FYI you need the class name "spapage" in order to have the div be a page