Skip to content

Commit 0c0378c

Browse files
author
laker007
committed
first commit
1 parent 7e04002 commit 0c0378c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/App.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {connect} from 'react-redux';
2+
import MyComponent from './myComponent';
3+
4+
function mapStateToProps(state,ownProps) {
5+
console.log(state)
6+
console.log(ownProps)
7+
return {text: state.text, name: state.name}
8+
}
9+
10+
function mapDispatchToProps(dispatch) {
11+
return {
12+
onChange: (e) => {
13+
console.log(dispatch)
14+
console.log(e)
15+
dispatch({type: 'change', payload: e})
16+
}
17+
18+
}
19+
}
20+
21+
const App = connect(
22+
mapStateToProps,
23+
mapDispatchToProps
24+
)(MyComponent);
25+
26+
export default App;

0 commit comments

Comments
 (0)