0.0.3 • Published 3 years ago

@cig/switch v0.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
3 years ago

@cig/switch

The Switch control for React.

Demo

https://codesandbox.io/s/cigswitch-mlnkr

Installation and usage

The easiest way to use @cig/switch is to install it from npm and build it into your app with Webpack.

npm i -S @cig/switch

Then use it in your App:

import React, {
  useState,
} from 'react'
import Switch from '@cig/switch'


export default () => {
  const [value, setValue] = useState(true)

  return (
    <Switch
      value={value}
      update={v => setValue(v)}
    />
  )
}

Props

名称类型必填默认值描述
valueArrayN-默认选项
updateFunctionN-数据更新回调