Hard
function withComments(WrappedComponent){
class CommentsFetcher extends React.Component{
constructor(props){
super(props);
this.state={
comments:[],
isFetchingComments: true,
commentsError: null,
};
}
componentDidMount(){
fetchComments()
.then((comments)=>this.setState({comments, isFetchingComments: false}))
.catch((error)=>this.setState({isFetchingComments: false, commentsError: error}));
}
render(){
return<WrappedComponent{... this.props}{... this.state}/>;
}
}
return CommentsFetcher;
}
Check the statement(s) that are true:
Author: Victor SabatierStatus: PublishedQuestion passed 1366 times
Edit
5
Community EvaluationsNo one has reviewed this question yet, be the first!
Similar QuestionsMore questions about React