我有一个容器组件,应该在装入时使用项目数据填充redux存储,组件正确地使用所请求的public static Bitmap getBitmapFromURL(String src){
try{
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
}catch(IOException e){
return null;
}
}
调用该操作。该操作返回一个永不执行的Option Compare Database
Option Explicit
Public varfield As String
varfield = [Jersey Number]
sConcat = ConcatRelated(" & varfield & ","[PlayerInfoImport]","playernumber = " & playernumber)
函数,因此永远不会检索数据。
我做错了什么?
我的容器组件是:
id
我的操作文件如下所示:
dispatch
答案 0 :(得分:1)
您在致电fetchItem
时忘记使用componentDidMount() {
return this.props.dispatch(fetchItem(this.props.match.params.number));
}
:
dispatch
或者,如果您不想直接在componentDidMount
中使用mapDispatchToProps
,则可以直接使用const mapStateToProps = (state, props) => {
return {
item: state.item,
user_location: state.user_location
};
};
const mapDispatchToProps = dispatch => {
return({
fetchItem: (number) => dispatch(fetchItem(number)),
})
}
export default connect(mapStateToProps, mapDispatchToProps)(ItemDetailsContainer);
:
componentDidMount() {
return this.props.fetchItem(this.props.match.params.number);
}
在componentDidMount中:
{{1}}