In the return method of my react component I want to have check to async function and return only if satisfied. This is my code:
render() {
var data = new MyClass()
data.helper(function(response){
if(response.status === "authorised"){
return (
<div>
<List videos={videos}/>
</div>
)
}else{
return (
<div>
<p>Please wait</p>
</div>
)
}
})
}
But this way it is giving me error saying:
A valid react component must be returned. You are returning either array or list or undefined
I want to show the data only after my logic.