Skip to content

Commit 2dc5ed4

Browse files
authored
Merge pull request #65 from contentstack/fix/updated-render-method
fix:updated render method
2 parents ba77942 + 6fe9adf commit 2dc5ed4

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

ui/src/components/jsoneditor/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useRef, useEffect } from "react";
1+
import React, { useRef } from "react";
22
import { JsonEditor } from "jsoneditor-react";
33
import ace from "brace";
44
import "brace/mode/json";
@@ -13,10 +13,6 @@ const JSONEditor: React.FC<TypeJsonProps> = function ({
1313
}) {
1414
const jsonEditorRef = useRef<JsonEditor | null>(null);
1515

16-
useEffect(() => {
17-
jsonEditorRef?.current?.set(value);
18-
}, [value]);
19-
2016
const setRef = (instance: any) => {
2117
jsonEditorRef.current = instance?.jsonEditor;
2218
};

ui/src/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Import React modules */
22
import React from "react";
3-
import ReactDOM from "react-dom";
3+
import { createRoot } from "react-dom/client";
44
/* Import other node modules */
55
import reportWebVitals from "./reportWebVitals";
66
/* Import our modules */
@@ -9,14 +9,15 @@ import App from "./containers/App";
99
/* Import our CSS */
1010
import "./index.css";
1111

12-
ReactDOM.render(
12+
const container = document.getElementById("root") as HTMLElement;
13+
const root = createRoot(container); // createRoot(container!) if you use TypeScript
14+
root.render(
1315
<React.StrictMode>
1416
<App />
15-
</React.StrictMode>,
16-
document.getElementById("root")
17+
</React.StrictMode>
1718
);
1819

1920
// If you want to start measuring performance in your app, pass a function
2021
// to log results (for example: reportWebVitals(console.log))
2122
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
22-
reportWebVitals();
23+
reportWebVitals();

0 commit comments

Comments
 (0)