Error while using useDataQuery

Hi experts,
I was trying to create a webapp where I try to pull data from the dhis2 server. But am getting an error; it is saying me to use QueryClientProvider. Any clue, will be absolutely helpful.
BTW, I’m using windows OS notebook. I used -
yarn create react-app dhis-data-download
d2 app scripts init dhis-data-download
to create and load the libraries. Then I used
const { loading, error, data } = useDataQuery(query1)
to pull the data. I did the same thing this way before. But this time its not working.

regards,
Monjur

1 Like

At your root level entry point, wrap the App component in a QueryClientProvider

1 Like

Many thanks @kose. This is helpful. Still struggling with the structures. I guess my d2.config.js is not working properly. Although its pointing the entry point App.js, the system is getting the entry point index.js. Hope you understanding it.

1 Like

Hello @Monjur, what version if d2 cli did you use to bootstrap the app?

1 Like

Hello @nnkogift. I found d2 version was 4.4.2. I didn’t installed a specific version. I used
yarn global add @dhis2/cli
command to install it. Are you referring me a specific version?
Thanks in advance.

Thanks everyone. I have used
npx @dhis2/cli-app-scripts init myapp
command to get the proper project structure.

4 Likes