Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example with react-router-dom #12

Open
CosticaPuntaru opened this issue Aug 28, 2018 · 1 comment
Open

example with react-router-dom #12

CosticaPuntaru opened this issue Aug 28, 2018 · 1 comment

Comments

@CosticaPuntaru
Copy link

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
Copy link
Author

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>
        )
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant