faceyspacey / faceyspacey/react-universal-component

How to check that the component has loaded?

Open
#213 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.7k
Forks
80
PR merge metrics
No merged PRs in 30d

Description

What is the best way to detect that the `DoThis` has loaded?

```
const DoThis = universal(import(/* webpackChunkName: 'do-this' */ 'src/do-this.js'));

class DoThisLoader extends React.Component {
constructor() {
super();
this.state = {
dataLoaded: false,
};
}

componentWillMount() {
DoThis.preload();
}

componentDidMount() {
loadSomeData().then(() => this.setState({ dataLoaded: true }));
}

render() {
return dataLoaded && DoThis ? : ;
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.