Course lesson
Add urql to a React Native Project and Fetch Data With the useQuery Hook
Start with a plain React Native app initialised using the React Native TypeScript template.
- Duration
- 6 min
- Access
- Included
- Transcript
- Retained from source evidence
Start with a plain React Native app initialised using the React Native TypeScript template.
We will install and configure urql, use urql's useQuery hook to fetch all stories from the locally running graphQL API, and render them in a FlatList.
Resources:
- React Native TypeScript template: https://reactnative.dev/docs/typescript
- urql docs: https://formidable.com/open-source/urql/docs/
Android:
- run the app with
yarn android - use
http://10.0.2.2:3000/graphqlinstead ofhttp://localhost:3000/graphqlfor the API endpoint
Checkpoint:
- Initial commit (create from template)
- Add initial project (remove template UI code) <-- video starts from here
- Add urql and useQuery