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!
4
Fix the following React component: Scroller7
Optimize a React component by implementing shouldComponentUpdate3
Write a React component as a function7
How to submit a form in React4
Write the missing code to render the children of the UserProfile component.7
Improve this React component so that it displays "Green" by default.3
Fix the following React component: