@rcp/use.valuesstate
v2.0.0
Published
The useful methods exported for values state
Downloads
3
Maintainers
Readme
@rcp/use.valuesstate
The useful methods exported for values state
Installation
npm install @rcp/use.valuesstate
# or use yarn
yarn add @rcp/use.valuesstate
API
ValuesHelper
Type: Object
Parameters
values
{T[]}setValues
{(values: T[]) => void}remove
{(value: T) => void}add
{(value: T) => void}toggle
{(value: T) => void}indexOf
{(value: T) => number}has
{(value: T) => boolean}
useValuesHelper
Parameters
stateValues
{T[]}setValues
{(values: T[]) => void}
Returns ValuesHelper
useValuesState
Parameters
values
{any[]}
Examples
import useValuesState from '@rcp/use.valuesstate'
function App() {
const {values, add, remove} = useValuesState([])
return <button onClick={() => add('something')}>Add</button>
}
Returns ValuesHelper
Related
Authors
This library is written and maintained by imcuttle, [email protected].
License
MIT