diff --git a/README.md b/README.md index 3e6fd41..265b441 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@ Demo: https://codesandbox.io/s/peaceful-rgb-i6fuq - Drop-in replacement for [useState](https://reactjs.org/docs/hooks-reference.html#usestate) including support for [functional updates](https://reactjs.org/docs/hooks-reference.html#functional-updates) and [lazy initial state](https://reactjs.org/docs/hooks-reference.html#lazy-initial-state). - Three ways to track changes: - - Create a snapshot for every change. - - Create snapshots at regular intervals. - - Only create snapshots for specific changes. + - Automatically create new snapshots at regular intervals. + - Automatically create a snapshot for every single change to state. + - Only create snapshots for specific changes to state. - Snapshots include timestamps and ID's so you can display a timeline of changes. - Configurable limit for the number of snapshots to keep. - Flow and TypeScript declarations included. @@ -18,20 +18,34 @@ Demo: https://codesandbox.io/s/peaceful-rgb-i6fuq ## Install +NPM: + +```shell +npm install use-state-snapshots +``` + +Yarn: + ```shell -yarn add useStateSnapshots +yarn add use-state-snapshots ``` ## Basic Usage ```js import React from "react"; -import useStateSnapshots from "useStateSnapshots"; +import useStateSnapshots from "use-state-snapshots"; const MyComponent = () => { const [state, setState, pointer, setPointer] = useStateSnapshots("Hello"); return (