Enable React strict mode
This enables React strict mode which will print extra warnings to the console when we use certain constructs incorrectly. This does not affect production builds. See https://beta.reactjs.org/reference/react/StrictMode
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as React from "react";
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { vscode } from "./vscode-api";
|
||||
|
||||
@@ -27,10 +28,12 @@ const render = () => {
|
||||
const view: WebviewDefinition = require(`./${viewName}/index.tsx`).default;
|
||||
|
||||
createRoot(element).render(
|
||||
// Post a message to the extension when fully loaded. See https://github.com/reactwg/react-18/discussions/5 ("What about the render callback?")
|
||||
<div ref={() => vscode.postMessage({ t: "viewLoaded", viewName })}>
|
||||
{view.component}
|
||||
</div>,
|
||||
<StrictMode>
|
||||
{/* Post a message to the extension when fully loaded. See https://github.com/reactwg/react-18/discussions/5 ("What about the render callback?")*/}
|
||||
<div ref={() => vscode.postMessage({ t: "viewLoaded", viewName })}>
|
||||
{view.component}
|
||||
</div>
|
||||
</StrictMode>,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user