Test.jsx
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from 'react'
import { connect } from 'react-redux'
import Text from '../../components/text/Text'
import { increment, decrement } from '../../action/countersAction'
const App = ({ message, counter, dispatch }) => (
<div className="container">
<Text />
{/* <div className="columns column is-12">
<h1>Counter : {counter}</h1>
</div> */}
<div className="buttons">
<button
onClick={() => dispatch(increment(1))}
className="button is-primary">
+1
</button>
<button onClick={() => dispatch(increment(2))} className="button is-link">
+2
</button>
<button onClick={() => dispatch(increment(3))} className="button is-info">
+3
</button>
</div>
<div className="buttons">
<button
onClick={() => dispatch(decrement(1))}
className="button is-primary">
-1
</button>
<button onClick={() => dispatch(decrement(2))} className="button is-link">
-2
</button>
<button onClick={() => dispatch(decrement(3))} className="button is-info">
-3
</button>
</div>
</div>
)
const mapStateToProps = state => ({
message: 'This is message from mapStateToProps',
counter: state.countersReducers || 0,
})
const AppWithConnect = connect(mapStateToProps)(App)
export default AppWithConnect