You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
580 B
21 lines
580 B
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>
|
|
);
|
|
} |