-
Notifications
You must be signed in to change notification settings - Fork 43
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
multiple instance on the same page #204
Comments
Hi @clodoveo, Can you show me some example code? I've definitely done experiments in the past with multiple instances of the same component and didn't have this problem, so I might be able to find the root of the problem if I see how you're using it. |
@bmomberger-bitovi
From above code, we are allowing any one of div to DOM, while showing 1st div, 2nd div is not DOM. |
What library are you using to remove and append these divs? Is it one with a virtual DOM? It's possible that the library is reusing the same web-app element for efficiency, which would lead to the condition you're describing. |
@bmomberger-bitovi |
You tried to show the web-app in React? React is a library that uses virtual DOM just like I described above. Here, this pen shows how the instance swap with regular DOM manipulation does not leave a stale value for Edit: If you see this problem in React, try generating a unique |
@bmomberger-bitovi Am facing issue in this scenario. the redux values are persists. |
@subramanian-iouring When you initialize your redux Provider, where is your store coming from? If it's always the same store object being passed to the redux Provder, then it will have the same values even if you remove the React root and re-create it. |
Here, is the exact code. which am using redux Provider. is any other way to resolve this issue?
// Using web-app in another react application
|
Your code shows What I would do instead is to have that module export a function like
useState() is used here because it will not revert to the initial store on component update, only on component mount. |
I'm trying to develop a widget that ideally should be instantiated multiple times on the same page. However, it is only being rendered for the first one in the list. Is it possible to have more than one with the same name but for example different IDs?
The text was updated successfully, but these errors were encountered: