123456789101112131415161718192021222324252627282930313233 |
- import {Provider, connect} from 'react-redux';
- import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux';
- import thunk from 'redux-thunk';
- import {actionPromise} from "./index"
- import {gql, actionGoods, getData, actionSearch, actionCartAdd} from "../reducers/index";
- import { useEffect } from 'react';
- import {OneGood, CGoodsList} from "./index";
- const mapStateToProps = state => ({
- state: state,
- search: getData(state, "search", "GoodFind")
- });
-
- const mapDispatchToProps = dispatch => bindActionCreators({
- getData: actionSearch,
- onAdd: actionCartAdd
- }, dispatch);
- const GoodsSearch = ({search, name, getData, onAdd}) => {
- useEffect(() => getData(name), [name])
- return(
- <>
- <div className = "goodsWrapper">
- <CGoodsList arr = {search} onAdd = {onAdd}/>
- </div>
- </>
- )
- }
- const CGoodsSearch = connect(mapStateToProps, mapDispatchToProps)(GoodsSearch);
- export default CGoodsSearch;
|