Home > Blockchain >  call an async method before ReactDOM.render()?
call an async method before ReactDOM.render()?

Time:12-01

I have to call an async method to load some remote configuration values in the LocalStorage.

Is it possible to await an async method before the ReactDOM.render(<App />, document.getElementById("root")); and call it once the configuration is loaded ?

CodePudding user response:

Yes.

async function boot() {
  await loadConfiguration();
  ReactDOM.render(<App />, document.getElementById("root"));
}
boot();
  • Related