{"_id":"@divyanshg10/react-use-state-with-history","_rev":"2-6d592a7a62dc5a0855c196bf97a3cbd7","name":"@divyanshg10/react-use-state-with-history","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@divyanshg10/react-use-state-with-history","version":"1.0.0","_id":"@divyanshg10/react-use-state-with-history@1.0.0","maintainers":[{"name":"divyanshg10","email":"divyanshg10@gmail.com"}],"dist":{"shasum":"567786019fb3a38dd4c705c267e2967150f2f766","tarball":"https://registry.npmjs.org/@divyanshg10/react-use-state-with-history/-/react-use-state-with-history-1.0.0.tgz","fileCount":15,"integrity":"sha512-DJkFNZhLtwHcEo3CApkKFJ775JpcSXGpYdrBT0WzYuJE1OkzxsdYEeQArinG3QZ4oiVJzMPx8xkXFFxJcwNA7w==","signatures":[{"sig":"MEYCIQDNh5iIjDIpueYk/CgeXsRMtWvP4j8b07FCvWp6I0MVuQIhAJedo9BOk0J4F0F5zZ0Ooi2OK14OTSKs+bD3osfNWe3I","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13695},"type":"module","gitHead":"0e7abe393f37e1874acd9b6a6b6b5484a06caa92","scripts":{"dev":"vite","lint":"eslint .","build":"tsc -b && vite build","preview":"vite preview"},"_npmUser":{"name":"divyanshg10","email":"divyanshg10@gmail.com"},"_npmVersion":"10.9.2","description":"## Contents","directories":{},"_nodeVersion":"22.14.0","dependencies":{"react":"^19.1.0","react-dom":"^19.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.3.5","eslint":"^9.25.0","globals":"^16.0.0","@eslint/js":"^9.25.0","typescript":"~5.8.3","@types/react":"^19.1.2","@types/react-dom":"^19.1.2","typescript-eslint":"^8.30.1","@vitejs/plugin-react":"^4.4.1","eslint-plugin-react-hooks":"^5.2.0","eslint-plugin-react-refresh":"^0.4.19"},"_npmOperationalInternal":{"tmp":"tmp/react-use-state-with-history_1.0.0_1747161186953_0.11410353601915757","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@divyanshg10/react-use-state-with-history","version":"1.0.1","type":"module","main":"./src/useStateWithHistory.tsx","scripts":{"dev":"vite","build":"tsc -b && vite build","lint":"eslint .","preview":"vite preview"},"dependencies":{"react":"^19.1.0","react-dom":"^19.1.0"},"devDependencies":{"@eslint/js":"^9.25.0","@types/react":"^19.1.2","@types/react-dom":"^19.1.2","@vitejs/plugin-react":"^4.4.1","eslint":"^9.25.0","eslint-plugin-react-hooks":"^5.2.0","eslint-plugin-react-refresh":"^0.4.19","globals":"^16.0.0","typescript":"~5.8.3","typescript-eslint":"^8.30.1","vite":"^6.3.5"},"publishConfig":{"access":"public"},"_id":"@divyanshg10/react-use-state-with-history@1.0.1","gitHead":"f9bcd1f9996fdb001d92a08a6e438030ec0efbed","description":"## Contents","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-ZLPITLo604CMgXRJcc7yeG7tF8ikCC3UFCeqcT1+zjQcQzu0clBSZBpulnolmxN0n0JfCfK0DCiNjfvuJs7o0A==","shasum":"fde32c688ec237c86e31c09f3d18b871f97858bb","tarball":"https://registry.npmjs.org/@divyanshg10/react-use-state-with-history/-/react-use-state-with-history-1.0.1.tgz","fileCount":15,"unpackedSize":13738,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIECCHGtOus+LFqaWrBRepfqqIXbKJFyeQj/EdPPxOHLiAiAsqFhaLx7uNp7XcNPmHgYhM3aCM9u3q1oO9f5mssIKsw=="}]},"_npmUser":{"name":"divyanshg10","email":"divyanshg10@gmail.com"},"directories":{},"maintainers":[{"name":"divyanshg10","email":"divyanshg10@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-use-state-with-history_1.0.1_1747161870015_0.8541974861525647"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-13T18:33:06.871Z","modified":"2025-05-13T18:44:30.366Z","1.0.0":"2025-05-13T18:33:07.137Z","1.0.1":"2025-05-13T18:44:30.173Z"},"description":"## Contents","maintainers":[{"name":"divyanshg10","email":"divyanshg10@gmail.com"}],"readme":"# useStateWithHistory Hook Example\n\n## Contents\n\n- [Features](#features)\n- [Usage](#usage)\n    - [Install dependencies](#1-install-dependencies)\n    - [Start the development server](#2-start-the-development-server)\n    - [How the hook works](#3-how-the-hook-works)\n    - [Example](#4-example)\n- [Project Structure](#project-structure)\n- [License](#license)\n\nThis project demonstrates a custom React hook, `useStateWithHistory`, which extends the standard `useState` by keeping a history of state values and providing undo functionality.\n\n## Features\n\n- **Custom Hook:** `useStateWithHistory` for state management with history tracking.\n- **Undo Support:** Easily revert to previous state values.\n- **Configurable History Length:** Limit the number of stored history entries.\n- **Sample App:** Simple React app to showcase the hook in action.\n\n## Usage\n\n### 1. Install dependencies\n\n```\nnpm install\n```\n\n### 2. Start the development server\n\n```\nnpm run dev\n```\n\n### 3. How the hook works\n\n```typescript\nconst [state, setState, history, undo] = useStateWithHistory<T>(initialValue, maxHistoryLength?)\n```\n\n- `state`: Current value.\n- `setState`: Function to update the value.\n- `history`: Array of previous values (including current).\n- `undo`: Function to revert to the previous value.\n\n### 4. Example\n\nSee `src/App.tsx` for a usage example.\n\n## Project Structure\n\n- `src/useStateWithHistory.tsx` — The custom hook implementation.\n- `src/App.tsx` — Sample app using the hook.\n- `index.html` — App entry point.\n\n## License\n\nMIT","readmeFilename":"README.md"}