mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
React: add typed target for change events
This commit is contained in:
committed by
Patricio Zavolinsky
parent
d26ba1fb9c
commit
cfe2a21973
@@ -672,3 +672,19 @@ class ConstructorSpreadArgsPureComponent extends React.PureComponent<{}, {}> {
|
||||
super(...args);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// The SyntheticEvent.target.value should be accessible for onChange
|
||||
// --------------------------------------------------------------------------
|
||||
class SyntheticEventTargetValue extends React.Component<{}, { value: string }> {
|
||||
constructor(props:{}) {
|
||||
super(props);
|
||||
this.state = { value: 'a' };
|
||||
}
|
||||
render() {
|
||||
return React.DOM.textarea({
|
||||
value: this.state.value,
|
||||
onChange: e => this.setState({value: e.target.value})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user