Skip to content

Commit

Permalink
Change to use the new API for the root render call reqired in version 18
Browse files Browse the repository at this point in the history
  • Loading branch information
jaltekruse committed Mar 17, 2023
1 parent 90f0454 commit d097e5d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 30 deletions.
9 changes: 4 additions & 5 deletions src/Tools/chat/index.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Router, Switch } from 'react-router';
import { createRoot } from 'react-dom/client';
import { RecoilRoot } from 'recoil';
import ToolRoot from '@ToolRoot';

import Chat from './Chat';
import { MathJaxContext } from 'better-react-mathjax';
import { mathjaxConfig } from '../../Core/utils/math';

ReactDOM.render(
const root = createRoot(document.getElementById('root'));
root.render(
<RecoilRoot>
<MathJaxContext
version={2}
Expand All @@ -17,6 +17,5 @@ ReactDOM.render(
>
<ToolRoot tool={<Chat key={'BaseTool'} />} />
</MathJaxContext>
</RecoilRoot>,
document.getElementById('root'),
</RecoilRoot>
);
8 changes: 4 additions & 4 deletions src/Tools/cypressTest/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import CypressTest from './CypressTest.jsx';
import axios from 'axios';
import { RecoilRoot } from 'recoil';
Expand All @@ -14,7 +14,8 @@ import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
// return <p>test</p>
// }

ReactDOM.render(
const root = createRoot(document.getElementById('root'));
root.render(
<RecoilRoot>
<Router>
<Routes>
Expand All @@ -31,8 +32,7 @@ ReactDOM.render(
} />
</Routes>
</Router>
</RecoilRoot>,
document.getElementById('root'),
</RecoilRoot>
);

// Hot Module Replacement (HMR) - Remove this snippet to remove HMR.
Expand Down
8 changes: 4 additions & 4 deletions src/Tools/singlepage/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { RecoilRoot } from 'recoil';

Expand All @@ -8,7 +8,8 @@ import { MathJaxContext } from 'better-react-mathjax';
import { mathjaxConfig } from '../../Core/utils/math';
import DarkmodeController from '../_framework/DarkmodeController';

ReactDOM.render(
const root = createRoot(document.getElementById('root'));
root.render(
<RecoilRoot>
<Router>
<Routes>
Expand All @@ -28,6 +29,5 @@ ReactDOM.render(
/>
</Routes>
</Router>
</RecoilRoot>,
document.getElementById('root'),
</RecoilRoot>
);
10 changes: 4 additions & 6 deletions src/Tools/temp/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';



ReactDOM.render(
const root = createRoot(document.getElementById('root'));
root.render(
<>
test here
</>,
document.getElementById('root'),
</>
);

9 changes: 5 additions & 4 deletions src/Tools/test/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import DoenetTest from './DoenetTest.jsx';
import { RecoilRoot } from 'recoil';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';

ReactDOM.render(

const root = createRoot(document.getElementById('root'));
root.render(
<RecoilRoot>
<Router>
<Routes>
Expand All @@ -15,6 +17,5 @@ ReactDOM.render(
} />
</Routes>
</Router>
</RecoilRoot>,
document.getElementById('root'),
</RecoilRoot>
);
7 changes: 4 additions & 3 deletions src/Tools/uiDocs/index.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { MathJaxContext } from 'better-react-mathjax';
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { mathjaxConfig } from '../../Core/utils/math.js';

import UIDocs from './uiDocs.jsx';

// import { initialize } from '../imports/courseInfo';
// initialize();

ReactDOM.render(
const root = createRoot(document.getElementById('root'));
root.render(
<MathJaxContext
version={2}
config={mathjaxConfig}
onStartup={(mathJax) => (mathJax.Hub.processSectionDelay = 0)}
>
<UIDocs />
</MathJaxContext>
, document.getElementById('root'));
);
8 changes: 4 additions & 4 deletions src/Tools/umn/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { RecoilRoot } from 'recoil';

Expand All @@ -8,7 +8,8 @@ import { MathJaxContext } from 'better-react-mathjax';
import { mathjaxConfig } from '../../Core/utils/math';
import DarkmodeController from '../_framework/DarkmodeController';

ReactDOM.render(
const root = createRoot(document.getElementById('root'));
root.render(
<RecoilRoot>
<Router>
<Routes>
Expand All @@ -28,6 +29,5 @@ ReactDOM.render(
/>
</Routes>
</Router>
</RecoilRoot>,
document.getElementById('root'),
</RecoilRoot>
);

0 comments on commit d097e5d

Please sign in to comment.