warnning: ignores the history prop. To use a custom history, use import { Router}
instead of import {HashRouter as Router}
Asked
Active
Viewed 673 times
0

Shubham Khatri
- 270,417
- 55
- 406
- 400

Yummy
- 33
- 4
-
Welcome to StackOverflow! Could you add your code to the question by copying and pasting the text and [formatting it as code](https://stackoverflow.com/editing-help#code)? – Unsolved Cypher Feb 16 '19 at 04:35
-
This warning should go with this answer https://stackoverflow.com/a/62583930 – Luis Torres Aug 25 '21 at 23:52
2 Answers
0
The warning clearly explains what is wrong in your code. HashRouter
and BrowserRouter
have their own predefined history
and hence they do not take history passed explicitly. In order to use custom history
you can use Router
from react-router-dom
import { Router, Route} from 'react-router-dom';
Also if you are using createBrowserHistory
and not using anywhere else except to pass it to the Router, you may as well use BrowserRouter
like
import { BrowserRouter as Router, Route} from 'react-router-dom';

Shubham Khatri
- 270,417
- 55
- 406
- 400