Masahiro Okubo

Type error: Property ‘onRouteChangeStart’ does not exist on type ‘SingletonRouter’.

Type error: Property ‘onRouteChangeStart’ does not exist on type ‘SingletonRouter’.
// だめ
Router.onRouteChangeStart = url => {};

// ok
Router.events.on('routeChangeStart', (url) => {
    console.log(url);
    NProgress.start();
})

参考記事

Multiple event listeners in Next.js router


関連記事

copyright© 2016-2021 Masahiro Okubo