Closed sriksm19 closed 2 years ago
I assume you're using history
as the snippet is? If so, the snippet was written before history
released v5, and I assume that's what you're using. You can downgrade to history
v4 if you'd like to keep using it. v5's types are incompatible with this library.
oh. thank you!
It might be worth keeping this open for visibility.
I'll try to whip up a quick PR tomorrow to get some more detail in the ReadMe. Hopefully will help people avoid this pitfall.
I wrote an adapter if you really want to use history
v5
import { HashHistory } from 'history';
import { CustomHistory } from 'preact-router';
export const hashHistoryAdapter = (hashHistory: HashHistory): CustomHistory => {
return {
listen: (callback) => hashHistory.listen(({ location }) => callback(location)),
location: hashHistory.location,
push: hashHistory.push,
replace: hashHistory.replace
};
};
Support for v5 was added in #410
tried using the snippet given in the example for custom history (i need it for the hash-router). getting the following typescript error