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