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 1550 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 shouldComponentUpdate7
How to submit a form in React7
Improve this React component so that it displays "Green" by default.4
Write the missing code to render the children of the UserProfile component.3
Optimize the following React component:3
Write a React component as a function