Skip to content

Commit 64a6520

Browse files
committed
update code to match latest version of REACT
1 parent 2e67d40 commit 64a6520

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

vscode-extension/webview-ui/src/context/ConfigurationProvider.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//===----------------------------------------------------------------------===//
1515

1616
/* eslint-disable indent */
17-
import React, { createContext, useState, useEffect } from "react";
17+
import React, { createContext, useState, useEffect, PropsWithChildren } from "react";
1818
import { vscode } from "../utilities/vscode";
1919

2020
/**
@@ -64,7 +64,7 @@ export const ConfigurationContext = createContext<{
6464
* Manages the application configuration state and provides it to the context.
6565
* @param children The child components wrapped by the provider.
6666
*/
67-
export const ConfigurationProvider: React.FC = ({ children }) => {
67+
export const ConfigurationProvider: React.FC<PropsWithChildren> = ({ children }) => {
6868
// Initial configuration state
6969
const initialConfig: Configuration = {
7070
projectName: "",

vscode-extension/webview-ui/src/index.tsx

+21-12
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import i18next from "i18next";
2121
import global_en from "./i18n/en/global.json";
2222
import { I18nextProvider } from "react-i18next";
2323
import { ErrorProvider } from "./context/ErrorProvider";
24+
import { createRoot } from 'react-dom/client';
25+
2426

2527
/**
2628
* Initialize i18next and set up localization resources.
@@ -40,15 +42,22 @@ i18next.init({
4042
* The root component of the application.
4143
* @returns {JSX.Element} The rendered root component.
4244
*/
43-
ReactDOM.render(
44-
<React.StrictMode>
45-
<ErrorProvider>
46-
<I18nextProvider i18n={i18next}>
47-
<ConfigurationProvider>
48-
<App />
49-
</ConfigurationProvider>
50-
</I18nextProvider>
51-
</ErrorProvider>
52-
</React.StrictMode>,
53-
document.getElementById("root"),
54-
);
45+
// Find your root element
46+
const container = document.getElementById('root');
47+
48+
// Create a root
49+
if (container) {
50+
const root = createRoot(container);
51+
52+
root.render(
53+
<React.StrictMode>
54+
<ErrorProvider>
55+
<I18nextProvider i18n={i18next}>
56+
<ConfigurationProvider>
57+
<App />
58+
</ConfigurationProvider>
59+
</I18nextProvider>
60+
</ErrorProvider>
61+
</React.StrictMode>
62+
);
63+
}

0 commit comments

Comments
 (0)