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 1541 times
Edit
6
Community EvaluationsNo one has reviewed this question yet, be the first!
7
How to submit a form in React3
Write the missing code to render the children of the UserProfile component.7
Improve this React component so that it displays "Green" by default.4
Fix the following React component: Scroller3
Optimize the following React component:7
Optimize a React component by implementing shouldComponentUpdate3
Write a React component as a function