RC Value ·
Make React component switch between Controlled Component
and Uncontrolled Component
easily.
Installation
yarn add rc-value
or npm install rc-value --save
Live Demos
You can find some demos at storybook
.
Usage
Value
import Value from 'rc-value' const Switch = <Value > value onChange <button = > </button> </Value> <Switch = = /> // This becomes an Uncontrolled Switch<Switch = =/> // This becomes a Controlled Switch
useValue
import useValue from 'rc-value' const Switch = props const value onChange = return <button =></button> <Switch = = /> // This becomes an Uncontrolled Switch<Switch = =/> // This becomes a Controlled Switch
withValue
import withValue from 'rc-value' const Switch = <Switch = = /> // This becomes an Uncontrolled Switch<Switch = =/> // This becomes a Controlled Switch