score:2

Accepted answer
// app.js

import { Router } from 'react-router'
import createBrowserHistory from 'history/createBrowserHistory'

export const myHistory = createBrowserHistory()

<Router history={myHistory}>
  <App/>
</Router>

// header.js

import { myHistory } from './app.js';

function captureLogoClick() {
  const logoLink = document.querySelector('#company-header .logo a');

  if(logoLink) {
    logoLink.addEventListener('click', (e) => {
      e.preventDefault();
      myHistory.push('/');
    });
  } else {
    // Resource hasn't loaded yet
    setTimeout(captureLogoClick, 100);
  }
}
captureLogoClick();

Related Query

More Query from same tag