You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/framework-integration/react.md
-64
Original file line number
Diff line number
Diff line change
@@ -393,70 +393,6 @@ function App() {
393
393
exportdefaultApp;
394
394
```
395
395
396
-
### Enable Server Side Rendering (SSR)
397
-
398
-
If your React framework supports server side rendering, e.g. [Next.js](https://nextjs.org/) your Stencil components will get automatically server side rendered, if set up correctly. In order to enable this:
399
-
400
-
1. Add a `dist-hydrate-script` output target to your `stencil.config.ts` if not already existing, e.g.:
401
-
```ts title="stencil.config.ts"
402
-
import { Config } from'@stencil/core';
403
-
404
-
exportconst config:Config= {
405
-
outputTargets: [
406
-
{
407
-
type: 'dist-hydrate-script',
408
-
dir: './hydrate',
409
-
},
410
-
// ...
411
-
]
412
-
};
413
-
```
414
-
415
-
2.Createanexportforthecompiledfileswithinthe`/hydrate`directory, e.g.
416
-
```json title="package.json"
417
-
{
418
-
"name": "component-library",
419
-
...
420
-
"exports": {
421
-
...
422
-
"./hydrate": {
423
-
"types": "./hydrate/index.d.ts",
424
-
"import": "./hydrate/index.js",
425
-
"require": "./hydrate/index.cjs.js",
426
-
"default": "./hydrate/index.js"
427
-
},
428
-
...
429
-
},
430
-
...
431
-
}
432
-
```
433
-
434
-
3.Setthe`hydrateModule`inyourReactoutputtargetconfiguration, e.g.
435
-
```ts title="stencil.config.ts"
436
-
import { Config } from '@stencil/core';
437
-
import { reactOutputTarget } from '@stencil/react-output-target';
That's it! Your Next.js application should now render a Declarative Shadow DOM on the server side which will get automatically hydrated once the React runtime initiates.
-ADeclarativeShadowDOMnotonlyencapsulatestheHTMLstructureofacomponentbutalsoincludesallassociatedCSS. Whenserver-siderenderingnumeroussmallcomponentswithextensiveCSS, theoveralldocumentsizecansignificantlyincrease, leadingtolongerinitialpageloadtimes. Tooptimizeperformance, it's essential to maintain a manageable document size that aligns with your performance objectives. It is advisable to server-side render only the critical components required for rendering the initial viewport, while deferring the loading of additional components until after the initial render.
457
-
-AStencilcomponentthatdynamicallyrenderscontentbasedonelementswithinitsLightDOMmaynotrendercorrectlyastheOutputTargetcan't always serialize the children of the React component into a template string especially when working with multiple nested Stencil components.
458
-
-CurrentlyStencildoesnotsupporttheserializationofobjectswithinproperties. ThismeansthatStencilignoresserversiderenderingallpropertiesthataredefinedwithareferencetypes, e.g. `object`.
Copy file name to clipboardExpand all lines: docs/framework-integration/vue.md
-67
Original file line number
Diff line number
Diff line change
@@ -348,73 +348,6 @@ In your page or component, you can now import and use your component wrappers:
348
348
</template>
349
349
```
350
350
351
-
### Enable Server Side Rendering (SSR)
352
-
353
-
If your Vue framework supports server side rendering, e.g. when using [Nuxt](https://nuxt.com/) your Stencil components will get automatically server side rendered, if set up correctly. In order to enable this:
354
-
355
-
1. Add a `dist-hydrate-script` output target to your `stencil.config.ts` if not already existing, e.g.:
356
-
```ts title="stencil.config.ts"
357
-
import { Config } from'@stencil/core';
358
-
359
-
exportconst config:Config= {
360
-
outputTargets: [
361
-
{
362
-
type: 'dist-hydrate-script',
363
-
dir: './hydrate',
364
-
},
365
-
// ...
366
-
]
367
-
};
368
-
```
369
-
370
-
2.Createanexportforthecompiledfileswithinthe`/hydrate`directory, e.g.
371
-
```json title="package.json"
372
-
{
373
-
"name": "component-library",
374
-
...
375
-
"exports": {
376
-
...
377
-
"./hydrate": {
378
-
"types": "./hydrate/index.d.ts",
379
-
"import": "./hydrate/index.js",
380
-
"require": "./hydrate/index.cjs.js",
381
-
"default": "./hydrate/index.js"
382
-
},
383
-
...
384
-
},
385
-
...
386
-
}
387
-
```
388
-
389
-
3.Setthe`hydrateModule`inyourVueoutputtargetconfiguration, e.g.
390
-
```ts title="stencil.config.ts"
391
-
import { Config } from '@stencil/core';
392
-
import { vueOutputTarget } from '@stencil/vue-output-target';
That's it! Your Nuxt application should now render a Declarative Shadow DOM on the server side which will get automatically hydrated once the Vue runtime initiates.
-ADeclarativeShadowDOMnotonlyencapsulatestheHTMLstructureofacomponentbutalsoincludesallassociatedCSS. Whenserver-siderenderingnumeroussmallcomponentswithextensiveCSS, theoveralldocumentsizecansignificantlyincrease, leadingtolongerinitialpageloadtimes. Tooptimizeperformance, it's essential to maintain a manageable document size that aligns with your performance objectives. It is advisable to server-side render only the critical components required for rendering the initial viewport, while deferring the loading of additional components until after the initial render.
416
-
-CurrentlyStencildoesnotsupporttheserializationofobjectswithinproperties. ThismeansthatStencilignoresserversiderenderingallpropertiesthataredefinedwithareferencetypes, e.g. `object`.
Allows to modify the document and all its containing components to be modified before the hydration process starts.
193
+
Allows to modify the document and all its containing components to be modified before the hydration process starts. This allows e.g. to assign properties to the components dynamically:
0 commit comments