A small Create React App repository containing several focused template components that demonstrate common React concepts: state, effects, context, reducers, custom hooks, forms, data fetching, and styling.
Contents
src/templates/Counter.js- useState counter examplesrc/templates/Todo.js- simple todo list (add/remove)src/templates/FetchUsers.js- data fetching withuseEffectsrc/templates/SimpleForm.js- controlled form examplesrc/templates/ContextTheme.js- React Context provider/consumer examplesrc/templates/UseReducerCounter.js-useReducerfor predictable statesrc/templates/CustomHookDemo.js- example custom hook (localStorage)src/templates/StyledCard.js- inline styling example
Getting started
- Clone the repository:
git clone https://github.com/jackghx/react.js-basics.git
cd react.js-basics- Install dependencies and start the development server:
npm install
npm start- Open the app in your browser at
http://localhost:3000.
Notes
- This project was created with Create React App and includes source maps, so the original
src/files are visible in the browser DevTools. - The
Appcomponent lets you switch between template components located insrc/templates. - Edit or extend the templates to experiment. Hot-reloading updates the running app automatically.
License
This repository contains example code for learning purposes. Use it freely in personal or educational projects.