gvergnaud / nextjs-dynamic-routes

[Deprecated] Super simple way to create dynamic routes with Next.js
MIT License
140 stars 7 forks source link

Add nextjs router events #8

Closed tychovbh closed 5 years ago

tychovbh commented 5 years ago

See open ticket: https://github.com/gvergnaud/nextjs-dynamic-routes/issues/7

The way that I implemented this you can use it exactly as described in the nextjs documentation so:

import Router from '../../routes'

const handleRouteChange = url => {
  console.log('App is changing to: ', url)
}

Router.events.on('routeChangeStart', handleRouteChange)
tychovbh commented 5 years ago

@gvergnaud PR updated!

gvergnaud commented 5 years ago

Published under v2.3.0. Thanks!