Skip to content

Commit

Permalink
Warning: ReactDOM.render is no longer supported fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianjanezic committed Mar 11, 2024
1 parent 186e139 commit 13e46e8
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/frontend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,38 +113,37 @@ const AppRoot = () => {
url: 'https://mor.org',
base64Icon: LOGO_METAMASK_BASE64,
},

modals: {
install: ({ link }) => {
let modalContainer: HTMLElement;

return {
mount: () => {
if (modalContainer) return;

modalContainer = document.createElement('div');

modalContainer.id = 'meta-mask-modal-container';

document.body.appendChild(modalContainer);

ReactDOM.render(
const modalRoot = createRoot(modalContainer);

modalRoot.render(
<QrCodeModal
onClose={() => {
ReactDOM.unmountComponentAtNode(modalContainer);
modalRoot.unmount();
modalContainer.remove();
}}
/>,
modalContainer,
);

setTimeout(() => {
updateQrCode(link);
}, 100);
},

unmount: () => {
if (modalContainer) {
ReactDOM.unmountComponentAtNode(modalContainer);

modalContainer.remove();
}
},
Expand Down

0 comments on commit 13e46e8

Please sign in to comment.