You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I want to re-render the component on a button click how can I do that? What if content loaded dynamically and I needed to init react after an ajax call. Any help appreciated.
The text was updated successfully, but these errors were encountered:
You raise a good point, dynamic containers is something that has been in the back log for a little while.
Currently the only way to do this is by disposing of your container and re-setting it when you load in new HTML dynamically. You could set up a utility method on the Bootstrapper to do this for you.
For example
Assign container to a property this.container
Create a reset method as below
class MyApp extends ReactHabitat.Bootstrapper {
constructor(){
super();
// Create a new container builder
this.container = new ReactHabitat.Container();
// Register your top level component(s) (ie mini/child apps)
this.container.register('SomeReactComponent', SomeReactComponent);
this.container.register('AnotherReactComponent', AnotherReactComponent);
// Finally, set the container
this.setContainer(this.container);
}
reset() {
this.dispose();
this.setContainer(this.container);
}
}
If I want to re-render the component on a button click how can I do that? What if content loaded dynamically and I needed to init react after an ajax call. Any help appreciated.
The text was updated successfully, but these errors were encountered: