Created
February 18, 2017 11:19
-
-
Save kenmori/579dc1a4ce07def65084c014024b0c79 to your computer and use it in GitHub Desktop.
【flowtype/React/Class】これ。how to fix 「Covariant property `[fn]` incompatible with contravariant use in ``` assignment of property `[fn]`」
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ////error | |
| this._increment = this._increment.bind(this); | |
| ^^^^^^^^^^ property `_increment`. Covariant property `_increment` incompatible with contravariant use in | |
| 27: this._increment = this._increment.bind(this); | |
| ^^^^^^^^^^^^^^^ assignment of property `_increment` | |
| /////// code //////// | |
| constructor(props: Props){ | |
| super(props); | |
| this.state = { | |
| value : this.props.value | |
| } | |
| this._increment = this._increment.bind(this);////flowtype Error | |
| this._decrement = this._decrement.bind(this);////flowtype Error | |
| }; | |
| _increment (e:any) { | |
| this.setState({ | |
| value: this.state.value + 1 | |
| }) | |
| } | |
| _decrement (e:any) { | |
| this.setState({ | |
| value: this.state.value -1 | |
| }) | |
| } | |
| ///////// |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment