GitShow/colinhacks/nextjs-react-router
colinhacks

nextjs-react-router

A demonstration of how to use React Router inside Next.js

by colinhacks
nextjsreact-routerspa
Star on GitHubForkWebsitenpm

TypeScript

159 stars30 forks2 contributorsQuiet · 3y agoSince 2020

Meet the team

See all 2 on GitHub →
colinhacks
colinhacks1 contribution

Commit activity

Last 12 weeks · 0 commits

Full graph →

Recent PRs & issues

Quiet · 5 discussions · Last activity 3y ago
See all on GitHub →
MarkWestside
Won’t work for static exportOpenIssue

As redirects are not possible for static HTML export, / (or index.html) will just return a blank page.

MarkWestside · 2y ago
ArmanEskandari
content of the page does not change on pressing back button of the browser while switching between pages ( Next page and regular one )OpenIssue
ArmanEskandari · 2y ago
richi-coder
Link click - NextJS and React/RouterOpenIssue

I have noticed kind of difference between both link components: NextJs Link and Router Link. Once a Router Link is clicked, a response can be seen by the user, since it changes the page inmediately. Some time it will take for data being fetched after page changes. In other context, once a NextJS Link is clicked, it takes a time for a response to be shown in the UI meanwhile NextJS fetches data to "avoid refreshing the whole page". As data arrives to the client, the wanted page renders to the screen. The difference: Router reacts first and waits later. NextJS waits first and reacts later. This can be perceived with slow networks. Offering reactive events to the user on SPAs developed with Router, and more sensitive feeling, while those NextJS based Multi Page Apps having the user with uncertainty and clicking the link many times awaiting for a UI reaction.

richi-coder · 3y ago

Recent fixes

View closed PRs →
yunsii
SSR is not work properlyClosedIssue

Below code causes the first screen rendering of the SSR have no HTML. https://github.com/colinhacks/nextjs-react-router/blob/master/pages/_app.tsx#L13

yunsii · 3y ago
laurencefass
Is it possible to create nested URLs for combinations of Next/React router paths?ClosedIssue

This example breaks attempting to nest URLs for correct routing with react router. Sandbox here: https://codesandbox.io/s/next-js-react-router-demo-w1y6x Ive added two pages - one with non-nested links (so react router overwrites next js URLS) and one attempting correct nested URLs in the address bar. The mnested routes using useRouteMatch dont work i guess because they are not tracking Next routers URL paths. ``` import React from "react"; import { BrowserRouter as Router, Switch, Route, Link, useRouteMatch } from "react-router-dom"; import NextLink from "next/link"; const Routed = () => { let { path, url } = useRouteMatch(); console.log(path, url); return ( <> Home (SSR) Test (SSR) Link one (SPA) Link two (SPA) Page one Page two ); }; export default function App() { return ( ); } Is there a way to support combinations of next/RR URLs and paths?

laurencefass · 4y ago
llm-gourmet
nested dynamic pathClosedIssue

Hello, Colin! Thanks for the nice project. I cannot route to a nested dynamic path like /pages/room/[id].tsx. It works with dynamic path like /pages/[id].tsx and also with nested path like /pages/room/fsfasf.tsx any ideas how to fix this? Cheers

llm-gourmet · 5y ago
Structured data for AI agents

Repository: colinhacks/nextjs-react-router. Description: A demonstration of how to use React Router inside Next.js Stars: 159, Forks: 30. Primary language: TypeScript. Homepage: https://vriad.com/essays/building-a-spa-with-nextjs Topics: nextjs, react-router, spa. Open PRs: 0, open issues: 5. Last activity: 3y ago. Top contributors: colinhacks.

·@ofershap

Replace github.com with gitshow.dev