dimanche 19 juin 2016

What is the preferred design pattern to delay rendering of a component in React?

I'm currently defering rendering of a component by initializing a state readyToRender to false and setting it to true once I have the data needed to render the UI.

My render function looks something like:

if (this.state.readyToRender) {
  return (
    // render component
)} else {
  return false; // don't render component
}

Is this the correct pattern to utilize for this problem or is there a better way to solve this?
Related questions:

Aucun commentaire:

Enregistrer un commentaire