fix(theme-ui): export jsx as createElement #1604
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.
Fix for #1603
The new JSX runtime transformation will sometimes use the
createElement
named export from thejsxImportSource
, howevertheme-ui
does not export its pragma under this name, causing crashes. This PR reexports thejsx
pragma under the namecreateElement
to fix this. For reference,@emotion/react
currently does the same thingA minimal reproduction case is rendering any JSX element with both spread props and a
key
prop:(codesandbox)
As far as I can tell, the tests use the classic runtime, so there is no way to write a test for this other than explicitly doing
import { createElement } from 'theme-ui'
and creating a node that way; is such a test worth having, since the use ofcreateElement
is essentially an implementation detail of the JSX transform?📦 Published PR as canary version:
0.6.1-canary.1604.15f511c.0
✨ Test out this PR locally via: