sindresorhus

react-router-util

Useful components and utilities for working with React Router

by sindresorhus

TypeScript

TypeScript100%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
71
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template
suchipi

Per https://twitter.com/sindresorhus/status/953743983678717955 We have these two helpers in our app which have been useful: Looks back in history to find which entry matches pathname, and then moves back to that entry. We implemented using MemoryRouter; depending on the limitations of BrowserRouter, it might but always be possible (I don't think BrowserRouter has an entries array on router.history). This is useful when you have routes in history that the user should not go back to, for example when going through a wizard or filling out a multi-step form. Goes back history.length - 1 and then replaces the current route with the new location (where location is anything that can be passed to history.push). This can be useful when, for example, the user logs out of the app. IssueHunt Summary sindresorhus has been rewarded. Backers (Total: $30.00) issuehunt ($30.00) Submitted pull Requests #25 Add function and component Tips Checkout the Issuehunt explorer to discover more funded issues. Need some help from other developers? Add your repositories on IssueHunt to raise funds.

suchipi · 1y ago
bthallion

I'm trying to write Ava unit tests for a component using AuthenticatedRoute, but I don't think there is a way to get this to work with the MemoryRouter right now. Do you have any suggestions for workarounds?

bthallion · 1y ago
sindresorhus

I didn't feel it was worth all the boilerplate and setup just for 4 super simple exports that I've manually tested well, but tests should be added when more things are added. Should use AVA. This task also includes adding prop types and default prop values to the types.** Inspiration: https://github.com/ReactTraining/react-router/tree/master/packages/react-router-dom/modules/__tests__ IssueHunt Summary mmulet has been rewarded. Backers (Total: $40.00) issuehunt ($40.00) Submitted pull Requests #341 fix frame flash on bounce #332 Tips Checkout the Issuehunt explorer to discover more funded issues. Need some help from other developers? Add your repositories on IssueHunt to raise funds.

sindresorhus · 1y ago
Structured data for AI agents

Repository: sindresorhus/react-router-util. Description: Useful components and utilities for working with React Router Stars: 324, Forks: 13. Primary language: TypeScript. Languages: TypeScript (100%). License: MIT. Topics: npm-package, react, react-component, react-router, router, utilities. Latest release: v1.0.0 (1y ago). Open PRs: 0, open issues: 0. Last activity: 1y ago. Community health: 71%. Top contributors: sindresorhus, agouil, antoniofpereir, Richienb, ronnyhaase, rafaelfbs.