I have to make a request using axios in order to fetch some data which should be passed as a prop to a React Component. Following is my render function:
render() {
boards = this.fetchBoardList();
return (
<div className="app-wrapper">
// Some HTML code
</div>
);
}
fetchBoardList is an async function, so it will return a promise. I can attach then and catch handlers to the return promise but in that case, I would have to put the same HTML code in both of the handlers. Is there any other way to do this?