An open API service indexing awesome lists of open source software.

https://github.com/tiberriver256/react-query-dependency-injection

Using React Query, React Context, Custom Hooks, and Typescript to make easy-to-use easy-to-test code for consuming an API in your React application
https://github.com/tiberriver256/react-query-dependency-injection

Last synced: 8 months ago
JSON representation

Using React Query, React Context, Custom Hooks, and Typescript to make easy-to-use easy-to-test code for consuming an API in your React application

Awesome Lists containing this project

README

          

# React Query Dependency Injection

Using React Query, React Context, Custom Hooks, and Typescript to make easy-to-use easy-to-test code for consuming an API in your React application.

## How to use this repo

This repo is a training resource for stepping through how to set up a wrapper
around an API using React Query and dependency injection via React Context.

The learning modules are split up into separate git branches. Each module builds
on the learnings of the previous module. The README.md will change for each
branch explaining the concept and will have working code you can inspect.

The modules are:

1. `1--dependency-injection` - Learning how to use React Context as a
dependency injection mechanism
2. `2--react-query-custom-hooks` - Covering how to wrap React Query into custom
hooks which make consumption a bit easier.
3. `3--react-query-dependency-injection` - Covering using dependency injection
within React Query custom hooks.

## Technology

* [Create-React-App](https://create-react-app.dev/)
* [TypeScript](https://www.typescriptlang.org/)
* [React Query](https://react-query.tanstack.com/)
* [React Context](https://reactjs.org/docs/context.html)
* [Custom Hooks w/ React Context](https://kentcdodds.com/blog/how-to-use-react-context-effectively)