Support custom rehydratable query selectors#6
Merged
Conversation
chrisvxd
commented
Sep 15, 2020
monospaced
approved these changes
Sep 15, 2020
715f562 to
9b0f36e
Compare
04270af to
d297aa9
Compare
Base automatically changed from
chrisvxd/automatically-rehydrate-children
to
master
September 16, 2020 09:45
d297aa9 to
9f9f234
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Blocked by #4. Migrated from simon360/react-from-markup#49.
What?
Enables custom query selectors, which can eliminate any custom markup.
Instead of this
You can now have this
By configuring your rehydrate method with the new
getQuerySelector()methodHow?
This PR extends replaces reading of the
data-rehydratableattribute with a query selector. By default, this query selector will check fordata-rehydratable, but this can be overridden using thegetQuerySelectorparam.You can get quite creative with your selectors, targeting whatever you want.
Breaking changes
This PR contains no breaking changes
Considerations
There is a slight performance penalty to doing this instead of reading the
data-rehydratableattribute directly, in particular due to the introduction of some new loops. I'll do my best to point them out via PR line comments.TODO
Docs