forked from mrizky-kur/Redux-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRedux.js
38 lines (35 loc) · 812 Bytes
/
Redux.js
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
import React from 'react';
import { Provider, connect } from 'react-redux';
import { store, testSlice, someAction } from './store';
const { actions } = testSlice;
const { otherAction, finalAction } = actions;
const App = ({
someProperty,
otherProperty,
/* ... */
finalProperty,
someAction,
otherAction,
/* ... */,
finalAction,
}) => (
<Provider store={store}>
<button
onClick={() =>
someAction(1)
}
type="button"
> Test
</button>
</Provider>
);
const mapStateToProps = state => ({
someProperty: state.someProperty,
otherProperty: state.otherProperty,
/* ... */,
finalProperty: state.finalProperty,
});
export default connect(
mapStateToProps,
{ someAction, otherAction, /* ... */, finalAction },
)(App);