Skip to content
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

Wrap preact.Fragment with preact.createElement #35418

Merged
merged 2 commits into from Jul 29, 2021

Conversation

caroqliu
Copy link
Contributor

@caroqliu caroqliu commented Jul 27, 2021

While preact.Fragment is a function, react.Fragment is not. This PR nests with preact.createElement to account for remapping preact -> react. Fixes #35412. Related to #35678

@caroqliu caroqliu requested a review from jridgewell July 27, 2021 18:29
@developit
Copy link

Might also be worth considering having this return props.children to avoid the nesting altogether. Using <Fragment key="" /> will still work like it would on a Fragment, because it'll be applied to the component:

function Fragment(props) {
  return props.children;
}

@caroqliu
Copy link
Contributor Author

Might also be worth considering having this return props.children to avoid the nesting altogether. Using <Fragment key="" /> will still work like it would on a Fragment, because it'll be applied to the component:

function Fragment(props) {
  return props.children;
}

Thanks for the recommendation, updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bento: TypeError when using React.Fragment
5 participants