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