DEV Community

Discussion on: Build a very basic SPA JavaScript router

Collapse
 
mactepyc profile image
MACTEPyc • Edited

An error occurs

  1. Added to HTML
    Added to html

  2. Added to JS
    Added to js

  3. We get an error
    We get an error

Collapse
 
mactepyc profile image
MACTEPyc

I decided

Case-insensitive search
Case-insensitive search

P.S. Thanks for the router, what I needed

Collapse
 
labzdjee profile image
Gérard Gauthier

Well, parseLocation (findComponentByPath uses) transforms any upper case letters to lower case letters, that's why you need the i switch downstream
You could also modify parseLocation
I also noticed \\ as well as gm are unnecessary in the RegExp.