const useState = React.useState;
function getComponentProps(node) {
const attributeNames = node.getAttributeNames();
const props = {};
for (const attributeName of attributeNames) {
if (attributeName.startsWith("data-")) {
const propName = attributeName.slice(5);
props[propName] = node.getAttribute(attributeName);
}
}
return props;
}
function mountComponent(querySelector, Component) {
const containers = document.querySelectorAll(querySelector);
for (const container of containers) {
const props = getComponentProps(container);
const root = ReactDOM.createRoot(container);
root.render(