You use this. It is even mentioned in the docs :)
https://github.com/tighten/ziggy
If you're using Laravel, the Ziggy library ...
Btw. I suggest installing this instead of loading the js part from composer. It gives better autocomplete https://www.npmjs.com/package/ziggy-js