3

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>
  );
}
  • https://reacttraining.com/react-router/web/example/preventing-transitions should help you – palsrealm Nov 22 '17 at 18:29
  • Check this https://stackoverflow.com/questions/32841757/detecting-user-leaving-page/45869459#45869459 for `onLeave` and https://stackoverflow.com/questions/45429963/fetching-data-before-route-change-in-react-router-v4/45430656#45430656 for `onEnter` – Shubham Khatri Nov 22 '17 at 18:33

0 Answers0