Skip to content
This repository was archived by the owner on Jan 21, 2018. It is now read-only.

Commit 0d374f7

Browse files
committed
Move flow-typed; Merge ownProps with stateProps for typecheck
1 parent f22cfdf commit 0d374f7

File tree

6 files changed

+10
-13
lines changed

6 files changed

+10
-13
lines changed
File renamed without changes.
File renamed without changes.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"start": "react-scripts start",
1818
"build": "react-scripts build",
1919
"eject": "react-scripts eject",
20-
"flow": "flow"
20+
"flow": "flow",
21+
"flow:stop": "flow stop"
2122
},
2223
"eslintConfig": {
2324
"extends": "./node_modules/react-scripts/config/eslint.js"

src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class App extends Component {
1515
render() {
1616
return (
1717
<Provider store={ store }>
18-
<Counter />
18+
<Counter text="some text" />
1919
</Provider>
2020
);
2121
}

src/Counter.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@ type OwnProps = {
1818

1919
type StateProps = {
2020
counter: number,
21-
};
21+
} & OwnProps;
2222

2323
type DispatchProps = {
2424
increase: () => void,
2525
decrease: () => void,
2626
};
2727

28-
type Props = OwnProps & StateProps & DispatchProps;
28+
type Props = StateProps & DispatchProps;
2929

30-
const mapStateToProps = (state: State): StateProps => ({
30+
const mapStateToProps = (state: State, ownProps: OwnProps): StateProps => ({
3131
counter: state.ui.counter,
32+
...ownProps,
3233
});
3334

34-
const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
35+
const mapDispatchToProps = (dispatch: Dispatch, ownProps: OwnProps): DispatchProps => ({
3536
increase: () => {
3637
dispatch(increase());
3738
},

src/configureStore.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
// @flow
22

3-
import { applyMiddleware, createStore } from 'redux';
4-
import thunk from 'redux-thunk';
3+
import { createStore } from 'redux';
54

65
import app from './reducers';
76

8-
const createStoreWithMiddleware = applyMiddleware(
9-
thunk,
10-
)(createStore);
11-
12-
export default () => createStoreWithMiddleware(app);
7+
export default () => createStore(app);

0 commit comments

Comments
 (0)