Skip to content

Commit

Permalink
* core: add static method to render html for react component.
Browse files Browse the repository at this point in the history
  • Loading branch information
catouse committed May 13, 2024
1 parent e19b1c6 commit 60081ea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/core/src/react/component-from-react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,10 @@ export class ComponentFromReact<O extends {} = {}, C extends ComponentReact<O> =
element,
);
}

static renderHTML(options: Record<string, unknown>): string {
const tmpNode = document.createElement('div');
render(h(this.Component as ComponentClass, options), tmpNode);
return tmpNode.innerHTML;
}
}

0 comments on commit 60081ea

Please sign in to comment.