0

warnning: ignores the history prop. To use a custom history, use import { Router} instead of import {HashRouter as Router}

enter image description here

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 Answers2

0

Try using this

import { Router, Route } from 'react-router-dom'
Wicak
  • 399
  • 4
  • 12
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