File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -18,26 +18,26 @@ import React, { Component } from 'react'
18
18
import easyState from ' react-easy-state'
19
19
20
20
@easyState
21
- export default class App extends Component {
22
- constructor () {
23
- super ()
24
- this .state = { counter: 0 }
21
+ class Counter extends Component {
22
+ state = { value: 0 }
23
+
24
+ increment () {
25
+ this .state ++
25
26
}
26
27
27
- render () {
28
- const { counter } = this .state
28
+ decrement () {
29
+ this .state --
30
+ }
29
31
32
+ render () {
30
33
return (
31
34
< div>
32
- < span> Counter: {counter}< / span>
33
- < button onClick= {this .increment }> Increment< / button>
35
+ {this .state .value }
36
+ < button onClick= {this .increment }> + < / button>
37
+ < button onClick= {this .decrement }> - < / button>
34
38
< / div>
35
39
)
36
40
}
37
-
38
- increment () {
39
- this .state .counter ++
40
- }
41
41
}
42
42
```
43
43
You can’t perform that action at this time.
0 commit comments