Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jatinpr's avatar

route method not found for TypeScript based ReactJS component for Inertia

Hi,

I am implementing an e-commerce application and transforming my components from JSX to TSX. I'm getting an issue with the 'route' method not being found in the TSX.

Any idea how I should fix this?

0 likes
5 replies
jatinpr's avatar

Yes. I'm asking for the ziggy route method. So, that route method is found for JSX component but not for TSX.

Thanks for the reply, and I'll give it a try.

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@jatinpr If you install it using npm, you should be able to import it like any other npm module

import route from 'ziggy-js'
2 likes
jatinpr's avatar

Thanks. It worked. I also executed the following command to remove the editor warnings.

npm i --save-dev @types/ziggy-js

Please or to participate in this conversation.