react-snippets
universal-router
Our great sponsors
react-snippets | universal-router | |
---|---|---|
8 | 1 | |
307 | 2 | |
- | - | |
0.0 | 2.1 | |
almost 2 years ago | over 2 years ago | |
JavaScript | TypeScript | |
MIT License | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
react-snippets
- Show HN: WebSockets with Request and Response in JavaScript
-
Show HN: React Routing in 120 lines (including comments)
I updated the repo for this (and credited you in the code). If you have time, please feel free to review & improve as looks like quite a few people are using the code now: https://github.com/ashok-khanna/react-snippets/blob/main/Rou...
-
Hacker News top posts: May 13, 2022
Show HN: React Routing in 120 lines\ (27 comments)
- Routing in 120 Lines (including comments)
- Routing in React in 120 Lines (including. how-to guide)
universal-router
-
Show HN: React Routing in 120 lines (including comments)
I use it like that and I am pretty happy with it.
There's one thing, you should redirect all the pages to one single endpoint in server side order to use "pushState". Otherwise it will return 404 when you hit the refresh button. If you don't own a server, you can support routing with hashtag "#" and listen to "onhashchange" event instead of "popstate".
Also, if you would like to support nested and dynamic routes (it's not possible with that code snippet in the github repository since it just checks like `path===currentPath`), you might look at the following solution:
https://github.com/fatih-erikli/universal-router/blob/main/u...
I use that solution in server-side and client-side so it works like Nextjs.
What are some alternatives?
MagLit - 🔥 MagLit - Privacy Respecting Encrypted Link Shortener with Password Protection and Torrent Magnet Links support
crossroad - 🛣 A React library to handle navigation in your WebApp. Built with simple components and React Hooks so your code is cleaner.
todomvc - Helping you select an MV* framework - Todo apps for React.js, Ember.js, Angular, and many more
awesome-go-orms - ORMs for Go, most starred on GitHub.
tokay - Tokay is a programming language designed for ad-hoc parsing, inspired by awk.
wouter - 🥢 A minimalist-friendly ~2.1KB routing for React and Preact
react-simplest-router - simplest router for React
page.js - Micro client-side router inspired by the Express router