Skip to content

Commit

Permalink
feat(theme): use createRoot to render app
Browse files Browse the repository at this point in the history
  • Loading branch information
3lang3 committed May 25, 2022
1 parent 3071ac1 commit 631002a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions packages/theme/hooks/useCodeSandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,14 @@ function getCSBData(
**/
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client'
${CSSDeps.map(({ css }) => `import '${css}';`).join('\n')}
import App from './App';
${opts.extra ? `${opts.extra}\n` : '\n'}
ReactDOM.render(
<App />,
document.querySelector('#root'),
);`,
const container = document.querySelector('#root')
const root = createRoot(container)
root.render(<App />)`,
};

// append other imported local files
Expand Down
9 changes: 4 additions & 5 deletions packages/theme/hooks/useStackBlitz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ function getStackblitzData(
**/
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client'
${CSSDeps.map(({ css }) => `import '${css}';`).join('\n')}
import App from './App';
${opts.extra ? `${opts.extra}\n` : '\n'}
ReactDOM.render(
<App />,
document.querySelector('#root'),
);`,
const container = document.querySelector('#root')
const root = createRoot(container)
root.render(<App />)`,
};

// append other imported local files
Expand Down

0 comments on commit 631002a

Please sign in to comment.