Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nirmaoz/react-router6-redirect
Redirect component for react-router v6
https://github.com/nirmaoz/react-router6-redirect
react react-router react-router-dom-v6 react-router-v6 reactjs
Last synced: about 1 month ago
JSON representation
Redirect component for react-router v6
- Host: GitHub
- URL: https://github.com/nirmaoz/react-router6-redirect
- Owner: nirmaoz
- License: mit
- Created: 2022-10-26T06:53:52.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T18:50:04.000Z (almost 2 years ago)
- Last Synced: 2024-10-17T06:49:04.460Z (2 months ago)
- Topics: react, react-router, react-router-dom-v6, react-router-v6, reactjs
- Language: TypeScript
- Homepage:
- Size: 4.88 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-router6-redirect
Redirect component for react-router v6.
Renders a `` component and handles any dynamic parts.## Why is this needed?
react-router v6 `` component does not handle dynamic parts of the `to` prop.## Install
```shell
npm i react-router6-redirect
```## Setup
```js
import {Route} from 'react-router-dom'
import {Redirect} from 'react-router6-redirect';
```## Usage
Important: each param name present in the `Redirect`'s `to` prop must exist in the `Route`'s `path` prop.
```jsx
}/>
```## Supported props
```ts
export interface RedirectProps {
to: string;
state?: any;
relative?: RelativeRoutingType;
}
```