Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

use-form-state

v1.0.1arrow_drop_down
v1.0.1
v1.0.0
STATUS
Passing
DOWNLOADS
74
VISIBILITY
Public
PUBLISHED
6 months ago
SIZE
N/A
If a checkbox has a user-defined value, its value the form state value will be an array.
1 contributor
Use use-form-state in your project ?
Copied
npm i @bit/aayush1408.must-have-hooks-in-your-toolbox.use-form-state
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
revert changes
reload
toggle layout
maximize
chevron_left
chevron_right

If a checkbox has a user-defined value, its value the form state value will be an array. Otherwise it will be considered a toggle.

Since checkbox and radio inputs have their own user-defined values, and since checkbox inputs can be either an array or a boolean, returning the value of input from the current form state is illogical

Limiting input validation on blur to: A) when it’s either touched for the time B) when it’s marked as dirty due to a value change