我们正在使用bindActionCreators调用API,每次我需要使用import pandas as pd
data_dict = {'a':[l for l in 'aakjnasnkdf']+[None],
'b':[l for l in 'aakjnasnkdf']+[1],
'c':range(12)}
df=pd.DataFrame(data_dict)
column_name1 ='a'
column_name2 = 'b'
df2=df.loc[:,[column_name1, column_name2]]
for i in range(0,len(df2)):
cell1, cell2 = df2.iloc[i]
cell1=str(cell1)
cell2 = str(cell2)
df2.iloc[i]=[cell1,cell2]
进行发布和获取数据时。
问题是我需要将响应数据存储在某个变量中并通过this.props
访问它。例如:
this.props.variable
我该怎么办?
答案 0 :(得分:0)
mapStateToProps
const mapStateToProps = state => ({
variableName: state.someVariableFromState
});
而且我不使用mapDispatchToProps,我直接通过动作来连接
import {action1, action2} from './someActionFolder';
export default connect(mapStateToProps, {action1, action2})(YourComponent);
在组件内部,您可以使用类似的操作
this.props.action1();
this.props.action2();
您还可以将所有动作组合在一起
import * as actions from './yourActionsFolder';
export default connect(mapStateToProps, actions);