petit-dom icon indicating copy to clipboard operation
petit-dom copied to clipboard

Hydrate existing markup

Open jimfranke opened this issue 2 years ago • 3 comments

How can I reuse existing markup from within the container that is being patched? I'm asking because I'm looking into SSR with hydration. Thanks!

jimfranke avatar Oct 11 '21 08:10 jimfranke

I understand it's currently not supported. What would be needed to implement it? @yelouafi

jimfranke avatar Oct 14 '21 06:10 jimfranke

Sorry for being late.

You can serve plain HTML from the server but currently the library doesn't support hydrating an existing DOM tree, you'll need to replace the whole tree with a new one (I think it should be a fast operation in modern browsers)

yelouafi avatar Oct 28 '21 15:10 yelouafi

Would this be complex to implement in the current architecture? I think adding this would really make this already awesome library shine :)

jimfranke avatar Nov 05 '21 08:11 jimfranke