Skip to content

Commit

Permalink
WRO-2188: [React18] Apply createRoot API to test app (#114)
Browse files Browse the repository at this point in the history
* WRN-12124: Remove deprecated babel-eslint module (#111)

* use @babel/eslint-parser

* restore eslint-config-enact version

* Update package.json

Co-authored-by: Mikyung Kim <mikyung27.kim@lge.com>

* Remove unused module

Enact-DCO-1.0-Signed-off-by: Mikyung Kim (mikyung27.kim@lge.com)

Co-authored-by: Mikyung Kim <mikyung27.kim@lge.com>

* WRN-12748: Update eslint 8 related modules in tool repos (#112)

* update eslint 8

* Update package.json

Co-authored-by: Mikyung Kim <mikyung27.kim@lge.com>

* Update package.json

Co-authored-by: Mikyung Kim <mikyung27.kim@lge.com>

Co-authored-by: Mikyung Kim <mikyung27.kim@lge.com>

* apply react18 API

* fix lint errors

* fixed merge conflict

* fix node_js: 14

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

Co-authored-by: Mikyung Kim <mikyung27.kim@lge.com>
Co-authored-by: Daniel Stoian <daniel.stoian@lgepartner.com>
  • Loading branch information
3 people committed May 31, 2022
1 parent b98ffa0 commit 138f073
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
14 changes: 5 additions & 9 deletions screenshot/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {render} from 'react-dom';
import {createRoot} from 'react-dom/client';
import App, {testMetadata} from 'UI_TEST_APP_ENTRY';
import TestChooser from './TestChooser';

Expand All @@ -18,13 +18,9 @@ if ('testId' in props) props.testId = Number.parseInt(props.testId);
if ('request' in props) {
window.__TEST_DATA = testMetadata;
} else if (Object.keys(props).length) {
render(
<App {...props} />,
document.getElementById('root')
);
createRoot(document.getElementById('root'))
.render(<App {...props} />);
} else {
render(
<TestChooser metadata={testMetadata} />,
document.getElementById('root')
);
createRoot(document.getElementById('root'))
.render(<TestChooser metadata={testMetadata} />);
}
8 changes: 3 additions & 5 deletions ui/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {render} from 'react-dom';
import {createRoot} from 'react-dom/client';
import App from 'UI_TEST_APP_ENTRY';

const url = new URL(window.location.href);
Expand All @@ -7,10 +7,8 @@ const locale = url.searchParams.get('locale');
const appElement = (<App locale={locale} />);

if (typeof window !== 'undefined') {
render(
appElement,
document.getElementById('root')
);
createRoot(document.getElementById('root'))
.render(appElement);
}

export default appElement;

0 comments on commit 138f073

Please sign in to comment.