This app showcases eight ways to handle React state.
Each branch implements the same features using different approaches.
Branch | State examples |
---|---|
main | useState, useRef, web storage, lifted state, derived state |
ref | useRef for uncontrolled components |
context | context |
immer | immer |
useReducer | useReducer |
class | Class-based state example |
react-query | React query for remote state |
Make sure you have these installed:
Then, run these commands on the command line:
npm install
npm start
npm start
starts the app and the mock API.
This project was bootstrapped with Create React App.