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