Execute a bootstrap method on your React/Preact components. Useful for data prefetching and other activities.
This allows you do tap the context in order to be aware your component is being executed within the async bootstrap cycle.
e.g.
componentWillMount() {
console.log(this.context.reactAsyncBootstrapperRunning) // true
}
react-tree-walker
v4, which has slightly different execution behaviour. Please go read release notes for it.asyncBootstrap
method on your components in favour of bootstrap
alternative name. Your asyncBootstrap
methods will still work, however you will get a deprecation warning printed.class Foo extends Component {
bootstrap() {
console.log(this.context.asyncBootstrapPhase)
}
render() {
return <div>foo</div>
}
}
bootstrapper(<Foo />, null, { asyncBootstrapPhase: true })
.then(() => console.log('done'))