docs: Add wrapper div to react's createShadowRootUi example

Related to #456.
This commit is contained in:
Aaron Klinker
2024-02-17 09:20:15 -06:00
parent 86d0c9b397
commit bc24ea45a4
+5 -1
View File
@@ -253,8 +253,12 @@ export default defineContentScript({
name: 'example-ui',
position: 'inline',
onMount: (container) => {
// Container is a body, and React warns when creating a root on the body, so create a wrapper div
const app = document.createElement('div');
container.append(app);
// Create a root on the UI container and render a component
const root = ReactDOM.createRoot(container);
const root = ReactDOM.createRoot(app);
root.render(<App />);
return root;
},