From 2dbb674e823681982a878b96cc12b68aa7b362e6 Mon Sep 17 00:00:00 2001 From: Aswinprasanth97 <126793115+Aswinprasanth97@users.noreply.github.com> Date: Sat, 22 Mar 2025 04:28:22 +0530 Subject: [PATCH] Updated code older react version to newer version syntax Root.render method was older updated to newer react syntax --- examples/basic-typescript/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/basic-typescript/index.tsx b/examples/basic-typescript/index.tsx index 38db7489b..a3a972ffe 100644 --- a/examples/basic-typescript/index.tsx +++ b/examples/basic-typescript/index.tsx @@ -2,6 +2,7 @@ import 'react-app-polyfill/ie11'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; import { Formik, Field, Form, FormikHelpers } from 'formik'; +import { createRoot } from 'react-dom/client'; interface Values { firstName: string; @@ -51,4 +52,8 @@ const App = () => { ); }; -ReactDOM.render(, document.getElementById('root')); +const rootElement = document.getElementById('root'); +if (rootElement) { + const root = createRoot(rootElement); + root.render(); +}