You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Warning about a container passed to the second argument of root.render()
#14144
I am trying to migrate a React 17 app that uses keycloak to React 18.
The problem is that I am getting the console error : (Warning: You passed a container to the second argument of root.render(...). You don't need to pass it again since you already passed it to create the root.)
Here is the updated index.js :
`import React from 'react';
import ReactDOM from 'react-dom/client';
import './fonts.css';
import './App.css';
import "antd/dist/antd.css";
import App from './App';
import reportWebVitals from './reportWebVitals';
keycloak.init({ onLoad: 'check-sso' }).then(authenticated => {
keycloak.postInit();
if (authenticated) {
// first hook on logout event and redirect to login
keycloak. () {
keycloak.redirectToLogin();
};
keycloak.loadReactDom(function (e) {
// load React DOM
root.render(
,
document.getElementById('root')
);
});
} else {
// just redirect to the login page
keycloak.redirectToLogin();
}
});
// root.render(
// <React.StrictMode>
//
// </React.StrictMode>
// );
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
`
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I am trying to migrate a React 17 app that uses keycloak to React 18.
The problem is that I am getting the console error : (Warning: You passed a container to the second argument of root.render(...). You don't need to pass it again since you already passed it to create the root.)
Here is the updated index.js :
`import React from 'react';
import ReactDOM from 'react-dom/client';
import './fonts.css';
import './App.css';
import "antd/dist/antd.css";
import App from './App';
import reportWebVitals from './reportWebVitals';
import { HashRouter } from 'react-router-dom';
import keycloak from './Keycloak.js';
const root = ReactDOM.createRoot(document.getElementById('root'));
keycloak.init({ onLoad: 'check-sso' }).then(authenticated => {
keycloak.postInit();
if (authenticated) {
// first hook on logout event and redirect to login
keycloak. () {
keycloak.redirectToLogin();
};
keycloak.loadReactDom(function (e) {
// load React DOM
root.render(
,
document.getElementById('root')
);
});
} else {
// just redirect to the login page
keycloak.redirectToLogin();
}
});
// root.render(
// <React.StrictMode>
//
// </React.StrictMode>
// );
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
`
All reactions