UNPKG

853 BMarkdownView Raw
1# @lwc/engine-server
2
3WARNING: This is an experimental package. It is subject to change, may be removed at any time,
4and should be used at your own risk!
5
6This package can be used to render LWC components as strings in a server environment.
7
8## Supported APIs
9
10This package supports the following APIs.
11
12### renderComponent()
13
14This function renders a string-representation of a serialized component tree, given a tag name
15and an LWC constructor. The output format itself is aligned with the [current leading
16proposal][explainer], but is subject to change.
17
18```js
19import { renderComponent } from 'lwc';
20import LightningHello from 'lightning/hello';
21
22const componentProps = {};
23const serialized = renderComponent('lightning-hello', LightningHello, componentProps);
24```
25
26[explainer]: https://github.com/mfreed7/declarative-shadow-dom/blob/master/README.md