@adobe-commerce/elsie 1.4.1-alpha102 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/docs/API/render.mdx +16 -0
package/package.json
CHANGED
package/src/docs/API/render.mdx
CHANGED
|
@@ -121,5 +121,21 @@ button.addEventListener('click', () => {
|
|
|
121
121
|
});
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
### Unmounting components without instance access
|
|
125
|
+
|
|
126
|
+
The `Render.unmount` static method provides a way to unmount components from the DOM when you don't have direct access to the component instance.
|
|
127
|
+
This is particularly useful in scenarios where components are rendered inside modals, dialogs, or other temporary containers that need to be cleaned up.
|
|
128
|
+
|
|
129
|
+
#### Example
|
|
130
|
+
|
|
131
|
+
```js
|
|
132
|
+
// Close the dialog
|
|
133
|
+
dialog.close();
|
|
134
|
+
|
|
135
|
+
// Unmount any dropin containers rendered in the modal
|
|
136
|
+
dialog.querySelectorAll('[data-dropin-container]').forEach(Render.unmount);
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
This approach ensures that all dropin components are properly cleaned up when their container elements are removed from the DOM, preventing memory leaks and maintaining application performance.
|
|
124
140
|
</Unstyled>
|
|
125
141
|
|