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
We recently switched to Preact from Lit and were looking for the same progressive enhancement behavior as @lit-labs/ssr provides. So we created preact-progressive-enhancement.
With this, we can define a web component that works as expected when run fully on client side but that also prerenders server side while retaining the custom html tags for targeted hydration.
So, given a Preact component:
const MyComponent = (props) => {
...
}
You define a progressively enhanced web component:
Which you can optionally hydrate by importing the file with the define call client side.
Combining this with the is-land component has resulted in an easy DIY island architecture in just a few lines of code and completely compatible with any frameworks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We recently switched to Preact from Lit and were looking for the same progressive enhancement behavior as
@lit-labs/ssr
provides. So we created preact-progressive-enhancement.With this, we can define a web component that works as expected when run fully on client side but that also prerenders server side while retaining the custom html tags for targeted hydration.
So, given a Preact component:
You define a progressively enhanced web component:
Which you can use during SSR:
And get prerendered html:
Which you can optionally hydrate by importing the file with the
define
call client side.Combining this with the
is-land
component has resulted in an easy DIY island architecture in just a few lines of code and completely compatible with any frameworks.Beta Was this translation helpful? Give feedback.
All reactions