example with react-router-dom
CosticaPuntaru opened this issue · 1 comments
CosticaPuntaru commented
As react router dom is the most used router for react. it will be nice to have an example of integrating the router with the bootstrapper to make sure the bootstrap function is called on route change (somehow)
CosticaPuntaru commented
a good enough solution is:
class DirectComponent extends Component {
bootstrap() {
console.log('direct bootstrap was called', this);
return new Promise((resolve) => {
setTimeout(() => {
resolve(1)
}, 2000)
})
}
componentDidMount() {
console.log('component did mount');
this.bootstrap();
}
render() {
console.log('render called');
return (
<div>
my component
</div>
)
}
}