This project demonstrates how to use a custom React hook to implement undo and redo functionality in a simple text editor. It supports grouped edits (so undo/redo works naturally), responsive layout, and clear UI using Tailwind CSS.
- Custom React hook (
useUndo) for managing input history - Undo and Redo buttons with simple logic
- Mobile-responsive layout
- Styled with Tailwind CSS
# Clone the project
git clone https://github.com/SanyaShresta25/customhook-demo.git
# Navigate to the project
cd customhook-demo
# Install dependencies
npm install
# Run the development server
npm run devThen open http://localhost:5173 in your browser.
src/
├── hooks/ # useUndo logic
├── components/ # TextEditor & Buttons
├── App.tsx # Root layout
├── main.tsx # Entry point
├── index.css # Tailwind setup
Click the heading in the app to explore: React Custom Hooks — Sharing Logic Between Components