nextjs-app-router-events
v1.0.2
Published
This module offers react hooks to work with ImageKit platform
Downloads
238
Readme
nextjs-app-router-events
This module offers a simple wrapper for NextJS's app router that provides ability to subscribe to navigation events.
Installation
Run the following command to install timer in your repository:
npm i nextjs-app-router-events
Usage
- Wrap your application by AppRouterEventsContextProvider
<AppRouterEventsContextProvider>
<App />
</AppRouterEventsContextProvider>
Use a hook:
useAppRouterEvents
to get access to the extended routerSubscribe to
beforeNavigate
const {subscribe} = useAppRouterEvents();
useEffect(() => {
const listener = () => console.log('Navigation is going to happen.');
const unsubscribe = subscribe('beforeNavigate', listener);
return () => {
unsubscribe();
};
}, [subscribe])
Contribution guidelines
You are encouraged to contribute to this project as soon as you see any defects or issues.
Code Editor Configuration
This repository contains configuration for VSCode editor. It doesn't mean that you cannot use a different tool. Feel free to push configurations for your favourite code editor.
Commands
- To build :
npm run build
- To lint use:
npm run lint
- To initialize pre-commit hooks use:
npm run prepare
Workflow
Before you get started make sure that there is noone working on an issue you are going to address.
As a first step, clone the repository and run npm i && npm run prepare
command to install all dependencies and initialize pre-commit hooks.
Create a branch to work on your code changes.
Once you are done with coding, create pull request and get an approval.
Lastly, enjoy your changes.