An open API service indexing awesome lists of open source software.

https://github.com/darcdev/router-spa-vainilla

Vainilla Javascript router creation workshop
https://github.com/darcdev/router-spa-vainilla

Last synced: 11 months ago
JSON representation

Vainilla Javascript router creation workshop

Awesome Lists containing this project

README

          

# Router Single Page Application (SPA)

## Vanilla Javascript router creation workshop

## Steps

**Load the route**
Identify where we are on the site. (Initial load of the route).

loadInitialRoute ()

**Compare the URL with a path**
The URL to which it moves us, must be compared with the routes we have.

matchUrlToRoute ()

**Update the URL in the navigation bar**
For this we will use the HTML pushState method.

`windows.history.pushState({},title,url)`

loadRoute ()

**Update the DOM with new content**
For this we are going to use innerHTML.

loadRoute ()