acl-services / acl-services/paprika
Make our core component uncontrolled.
- 主要言語
- JavaScript
- スター
- 54
- フォーク
- 10
- 平均マージ
- 1日 12時間
- マージ済み PR(30日)
- 6
説明
# Feature request
So far most of our core/basic component like input, select, checkbox are controlled component but there are lots of cases when we want to have an uncontrolled component and just listen for the onchange event. Should be simple to add this behaviour:
pseudo code ex:
```js
const Input = React.forwardRef((props, ref) => {
const [value, setValue] = React.useState(props.defaultValue);
function handleChange(event) {
if(defaultValue) {
setValue(() => event.target.value)
props.onChange(event.target.value)
return
}
props.onChange(event.target.value)
}
return
})
```
Something like that can be implemented in most of our components and be a pattern for basic ones.
## Additional context
*Add any other context or screenshots about the feature request here.*
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。