import ReactDOM from "react-dom/client";
import React, {FunctionComponent} from "react";

/**
 * Dynamically renders a React component, with given arguments
 * @param Component the react component to render
 * @param args the arguments to pass to the react component.
 */
export function renderView(Component: FunctionComponent, args: {}) {
    const root = ReactDOM.createRoot(
        document.getElementById('root') as HTMLElement
    );

    console.log(args)

    root.render(
        <React.StrictMode>
            <Component {...args}/>
        </React.StrictMode>
    );
}