basic frontend demo with react and redux
This commit is contained in:
19
frontend-react/src/utils/subcategorywrapper.js
Normal file
19
frontend-react/src/utils/subcategorywrapper.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { connect } from "react-redux";
|
||||
import { SUBCATEGORY_SELECT } from "constants/actionTypes";
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
subcategory: state.subcategory
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
onSubCategoryChanged: option =>
|
||||
dispatch({ type: SUBCATEGORY_SELECT, option })
|
||||
});
|
||||
|
||||
export const subcategorywrapper = component =>
|
||||
connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(component);
|
||||
Reference in New Issue
Block a user