DEV Community

Discussion on: Build a Single Page Application (SPA) Site With Vanilla.js

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I have my successful solution here. Might write an article later.

GitHub logo patarapolw / minimal-rollup-ts-pug-sass-template

Rollup + TypeScript + Pug + SASS template with no plan for JavaScript frameworks, whatsoever

In short, more than history.pushState, you also need window.dispatchEvent(new PopStateEvent('popstate', { state: { to } })); if you don't have history.go.

Now, you can listen to popstate events.