react-snap
react-snap copied to clipboard
"Basic usage with Preact" docs should be updated
Feature Request
Is your feature request related to a problem? Please describe.
The Preact Section in the readme, as they are out of date. Preact v10 has a proper hydrate method now. PR: preactjs/preact#1802.
Describe the solution you'd like Update the README essentially to what the React section looks like:
import { h, render, hydrate } from 'preact';
import { App } from './app';
const rootElement = document.getElementById('root');
if (rootElement.hasChildNodes()) {
hydrate(h(App), rootElement);
} else {
render(h(App), rootElement);
}
Teachability, Documentation, Adoption, Migration Strategy Document change.
A little bit of background:
I'm working with an unusual stack (mostly for fun) that includes htm
, preact
, and react-snap
. The previous documentation through me for quite a loop since htm
allows you to return sibling components:
htm`
<div id="one" />
<div id="two" />
`;
which renders to two different divs in the dom
The previous method: preact.render(<App />, rootElement, rootElement.firstElementChild);
would replace <div id="one" />
when it updated, but add an additional <div id="two" />
+1 to that