Skip to content

Commit

Permalink
Use deprecated ReactDOM.render as it is the only stable to avoid race…
Browse files Browse the repository at this point in the history
… conditions
  • Loading branch information
jablonski committed Oct 28, 2023
1 parent a7a0f09 commit c4a0168
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from "react";
import ReactDOM from "react-dom";
import { createRoot } from "react-dom/client";
import JsxParser from "react-jsx-parser";

export let TEMPLATING_ERROR = /<!--.*ERROR MESSAGE STARTS HERE.*-->/;
Expand All @@ -19,15 +18,7 @@ export function render(components, root, callback) {
callback();
}
};
if (
navigator.userAgent.includes("Safari") &&
!navigator.userAgent.includes("Chrome")
) {
ReactDOM.render(parse(components, root), root, restoreCallback);
} else {
createRoot(root).render(parse(components, root));
setTimeout(restoreCallback, 0);
}
ReactDOM.render(parse(components, root), root, restoreCallback);
}
}

Expand Down

0 comments on commit c4a0168

Please sign in to comment.