ziggy
ziggy copied to clipboard
Add `useRoute()` React hook
Adds a useRoute()
React hook. If the Ziggy
config object is available globally, usage is as simple as:
import { useRoute } from 'ziggy-js';
export default () => {
const route = useRoute();
return (
<a href={route('home')}>Home</a>
);
};
Closes #327.
Is there a way you can use this with typescript?
@FelipeVa no idea 😅 if you can import JavaScript modules into TypeScript then I don't see why not.
See here https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html
Since this package uses JSDoc it would be possible to generate definition files for the project.
Is there something similar for Vue?
@CamKem https://github.com/tighten/ziggy#vue