Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a declaration file for module 'react-query'

I am refactoring a piece of code and it shows this type of error whenever I try to import "react-query

like image 465
Jatin Nagla Avatar asked Jul 12 '26 13:07

Jatin Nagla


2 Answers

I ran into the same thing and had to downgrade to version 3.

npm i react-query@3

Or for 4+

npm i @tanstack/react-query
like image 174
James Avatar answered Jul 15 '26 11:07

James


It's because you are importing into a TypeScript file and it can't find the type declaration for the imported module. Normally all you need to do is to follow the given instructions and open a command prompt, go to the directory D:\overview and type:

npm i --save-dev @types/react-query
like image 36
heborg Avatar answered Jul 15 '26 11:07

heborg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!