Skip to content

Conversation

@chrisvxd
Copy link
Contributor

Description copied from simon360/react-from-markup#48.

What?

Implements support for containerless rehydration. Instead of

<html>
  <body>
    <div data-react-from-markup-container>
      <div class="Clock" data-rehydratable="Clock">
        15:21:11
      </div>
    </div>
  </body>
</html>

You can now have

<html>
  <body>
    <div class="Clock" data-rehydratable="Clock">
      15:21:11
    </div>
  </body>
</html>

How?

It does this by:

  1. Using the keys from the rehydrators object to query select all data-rehydratable tags
  2. Wrapping the root of that rehydratable in another element
  3. Using the new container as the React root

Breaking changes

It also introduces two breaking changes:

  1. rehydrateChildren now returns an object containing container and rehydrated
  2. data-rehydratable must now match the rehydrator key provided in rehydrators

The first of the two will become redundant in my following PR, where I will change how rehydrateChildren behaves entirely.

@chrisvxd chrisvxd requested a review from monospaced September 14, 2020 16:45
@chrisvxd chrisvxd mentioned this pull request Sep 14, 2020
Copy link
Member

@monospaced monospaced left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrisvxd chrisvxd merged commit cb1c528 into master Sep 15, 2020
@chrisvxd chrisvxd deleted the chrisvxd/remove-markup-containers branch September 15, 2020 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants