diff --git a/README.md b/README.md index 8722d8e..5365e34 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ $ pnpm add react-complex-state Pass the state you want to use in `useComplexState` hook like you do in `useState`. ```jsx -import useComplexState from "react-complex-state"; +import { useComplexState } from "react-complex-state"; function App() { const complexState = useComplexState(["John", "William"]); @@ -53,13 +53,14 @@ function App() { export default App; ``` -### Returns +## Returns | return | type | description | | ------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | value | array | The data of your state. | | setValue | function | The usual setState function. Use it if you want control over your state. | | insert | function | `(data: T, index?: number) => void`
Add data to your state at an index. By default it will add the data at the end. | +| insertMany | function | `(data: T[], index?: number) => void`
Add array of data to your state at an index. Defaults are similar to insert function. | | update | function | `(data: T, index: number) => void`
Update your state data at an index. | | partialUpdate | function | `(data: Partial, index: number) => void`
Update only the data that you passed at an index. Other remaining data will be unchanged. (Only usable when your state contains array of objects) | | remove | function | `(index: number) => void`
Delete your state data at an index. | diff --git a/package.json b/package.json index a1b55b7..d39a25f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-complex-state", "version": "1.0.1", - "description": "A complex local state made easy in react", + "description": "A custom hook that makes it easy when working with complex state in react.", "author": "Suzan-Dev", "license": "MIT", "main": "./lib/cjs/index.js",