-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(feat) - replaceNode parameter #1557
(feat) - replaceNode parameter #1557
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good addition to me 💯
expect(scratch.innerHTML).to.equal('<div id="a"></div><div id="b"></div><div id="c"></div>'); | ||
}); | ||
|
||
it('should render multiple render roots in one parentDom', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is so good 👍 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Was super awesome to see it grow on slack. The infographic is wonderful and really shows the benefits of this change. Thank you so much for making the PR, highly appreciated 👍 🥇
@LukasBombach Congrats on getting your first PR merged 🎉 |
Thank you so much! I am really happy and proud! And this feature will be so useful to us! |
@developit this should fix our problem with SSR in preact-cli, right? |
This implementation brings back the third optional parameter
replaceNode
from8.x
https://preactjs.com/guide/api-reference#preact-render-
With this parameter you can provide child node in your parent DOM that will be used as render root. It does not replace other children inside the parent and it will hydrate the provided node and not just replace it, the DOM nodes remain the same.
I made a more comprehensive infographic to describe why I see this as useful
https://gist.github.com/LukasBombach/884319d5430a3fb85f3b4385d7a31c89
You can try out a working usage in this repo: https://github.com/spring-media/pool-attendant (See index.partial.hydration.js)
ADDS: 16B to core