MCPcopy
hub / github.com/tighten/ziggy / useRoute

Function useRoute

src/js/index.js:27–41  ·  view source on GitHub ↗
(defaultConfig)

Source from the content-addressed store, hash-verified

25};
26
27export function useRoute(defaultConfig) {
28 if (
29 !defaultConfig &&
30 !globalThis.Ziggy &&
31 typeof Ziggy === 'undefined' &&
32 !document.getElementById('ziggy-routes-json')
33 ) {
34 throw new Error(
35 'Ziggy error: missing configuration. Ensure that a `Ziggy` variable is defined globally or pass a config object into the useRoute hook.',
36 );
37 }
38
39 return (name, params, absolute, config = defaultConfig) =>
40 route(name, params, absolute, config);
41}

Callers

nothing calls this directly

Calls 1

routeFunction · 0.85

Tested by

no test coverage detected