Try using createElement for renderAppender render prop #15259
Merged
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.
Description
This PR serves as an iteration on #14241 and #14943.
As mentioned in a couple of comments by @aduth, using
createElement
instead of the traditional function call when rendering a render prop offers more flexibility for the implementor of the render prop. The implementor can use the traditional render prop style:as well as using a simpler style without the need for the wrapping function:
The only downside I can see is that if parameters were added to
renderAppender
, they'd need to be expressed as props:instead of a plain argument:
which is inconsistent with other render props.
How has this been tested?
Types of changes
Non-breaking refactor
Checklist: