guillaumeparis2000 / react-piwik

Library that allow to connect piwik with the react-router and track custom events
31 stars 17 forks source link

TypeError: t.getCurrentLocation is not a function #12

Closed gardner closed 6 years ago

gardner commented 6 years ago

When using with React Router v4 I receive the error:

TypeError: t.getCurrentLocation is not a function

import { Router } from 'react-router-dom'
import ReactPiwik from 'react-piwik'
...
ReactDOM.render((
  <ApolloProvider store={store} client={client}>
    <Router history={piwik.connectToHistory(history)}>
      <App />
    </Router>
  </ApolloProvider>
), document.getElementById('root'))
gardner commented 6 years ago

Looks like it's happening here: https://github.com/guillaumeparis2000/react-piwik/blob/master/src/React-Piwik.js#L59

gardner commented 6 years ago

Looks like they removed the method in 4.0.x: https://github.com/ReactTraining/history/compare/v4.0.0-1...v4.0.0-2#diff-8b1c3fd0d4a6765c16dfd18509182f9dR5

gardner commented 6 years ago

Here's a PR to work around breaking changes in history: https://github.com/guillaumeparis2000/react-piwik/pull/13

guillaumeparis2000 commented 6 years ago

Thanks for the fix, I just went to publish it on the version 1.3.0