Using the keys from the rehydrators object to query select all data-rehydratable tags
Wrapping the root of that rehydratable in another element
Using the new container as the React root
Breaking changes
It also introduces two breaking changes:
rehydrateChildren now returns an object containing container and rehydrated
data-rehydratable must now match the rehydrator key provided in rehydrators
The first of the two is perhaps not necessary, but I can't quite remember the behaviour of rehydrateChildren. It may be possible to avoid a breaking change to this, and instead just implement the container swizzle a layer above.
TODO
[ ] Tests
[ ] Docs
Aside
My goal is to eliminate any markup delta entirely by optionally supporting class names instead of data-rehydratable, but this has some performance considerations I need to hash out.
I'm also aware that you may have reasons other than those we have already discussed for wanting a container, so feel free to throw this back in my face.
What?
Implements support for containerless rehydration. Instead of
You can now have
How?
It does this by:
rehydrators
object to query select alldata-rehydratable
tagsBreaking changes
It also introduces two breaking changes:
rehydrateChildren
now returns an object containingcontainer
andrehydrated
data-rehydratable
must now match the rehydrator key provided inrehydrators
The first of the two is perhaps not necessary, but I can't quite remember the behaviour of
rehydrateChildren
. It may be possible to avoid a breaking change to this, and instead just implement the container swizzle a layer above.TODO
Aside
My goal is to eliminate any markup delta entirely by optionally supporting class names instead of
data-rehydratable
, but this has some performance considerations I need to hash out.I'm also aware that you may have reasons other than those we have already discussed for wanting a container, so feel free to throw this back in my face.