The useful methods exported for values state
npm install @rcp/use.valuesstate
# or use yarn
yarn add @rcp/use.valuesstate
Type: Object
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}
stateValues
{T[]}setValues
{(values: T[]) => void}
Returns ValuesHelper
values
{any[]}
import useValuesState from '@rcp/use.valuesstate'
function App() {
const {values, add, remove} = useValuesState([])
return <button onClick={() => add('something')}>Add</button>
}
Returns ValuesHelper
This library is written and maintained by imcuttle, [email protected].
MIT