'How to implement history property and past it to Router... inside the index.tsx
I need help. How to implement history property to use it as a global prop and also in hole project(also in file with .ts extensions).
I need (history.push method) inside .ts (not functional components .tsx) file to redirect to the home page.
you can see images and the problem whit the history prop when I tried to pass inside Router. enter image description here
Solution 1:[1]
You've the latest version of history installed but you've the previous version of react-router-dom. react-router-dom@5 uses history@4.
- Uninstall the current version:
npm un -s history - Install the older version:
npm i -s history@4
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Drew Reese |

