How to use onLeave and onEnter ( or some hacks ) in Route with react-router-dom 4?

Viewed 6700

There is nothing in my console when I follow "localhost:3000" Which hooks ( or something else ) I can use instead ?

export default function getRoutes(store) {

  return (
    <AppComponent>
      <Switch>
          <Route 
            exact
            path="/" 
            component={CatalogBasePageComponent}
            onEnter={() => console.log('Works fine')}
          />
          <Route 
            path="/products/:ratingFilter/:categoryId" 
            component={CategoryProductsByFilterPageComponent}
          />
          <Route 
            path="/products/:ratingFilter" 
            component={CategoryProductsByFilterPageComponent}
          />
          <Route path="/category/:categoryId" component={CategoryPageComponent} />
          <Route path="/404" component={NotFoundComponent} />
      </Switch>
    </AppComponent>
  );
}
0 Answers
Related