@atomico/[email protected]
Now this hook is simpler, it only exposes the following utilities as a module:
- useRouter: hook for routing
- redirect: callback for redirecting
- getPath: callback for getting the path from useRouter
Example of useRouter
const { id, result, path, params, redirect } = useRouter<string>({
"/": () => "home",
"/config": () => "config",
});
- id: path from location.
- result: return of the callback.
- params: parameters of the callback.
- redirect: equivalent to redirect from the module.