Am developing a React Application where I want to use @types/history
module..
Installed
npm install --save @types/history
And in my component file trying to import like
import { createBrowserHistory, History } from 'history'
And
import { createBrowserHistory, History } from '@types/history'
But throwing exception like
Module not found: Can't resolve 'history' in
Thanks in advance.
When installing @types/history you are just providing typescript compiler with type information about history
package. Not the package itself. See for example this thread for some details.
Therefore - you must install history
package in order to use it:
$ npm install --save history
See more info about its usage at their github rep.
try to install history and react router dom package using npm
npm install --save history
npm install react-router-dom --save
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With