Checkbox must be passed 'onChange', otherwise an error will be reported during compilation
zhaoyiming0803 opened this issue · 1 comments
zhaoyiming0803 commented
A description of the problem, steps to reproduce, or with code samples, can be hosted on a GitHub repository with a link to the repository. (问题说明,重现步骤,或附上代码示例,可存放 GitHub 仓库并提供仓库链接。)
My codes is following:
import { Checkbox, CheckboxGroup } from '@quarkd/quark-react'
function TestQuarkComponent () {
const [groupValue, setGroupValue] = useState<string[]>(['苹果', '橘子'])
const onChangeCheckbox = (e: any) => {
console.log('on change checkbox: ', e)
setGroupValue(() => e.detail.value)
}
return <>
<CheckboxGroup value={groupValue.join()} onChange={onChangeCheckbox}>
<Checkbox name="apple"></Checkbox>
<Checkbox name="warning">橘子</Checkbox>
<Checkbox name="banana">香蕉</Checkbox>
</CheckboxGroup>
</>
}