Document using site-wide JSX pragma configuration
See original GitHub issue{
"plugins": [
[
"@babel/plugin-transform-react-jsx",
{
"throwIfNamespace": false, // defaults to true
"runtime": "automatic", // defaults to classic
"importSource": "theme-ui" // defaults to react
}
]
]
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:26 (16 by maintainers)
Top Results From Across the Web
JSX Pragma - Theme UI
JSX Pragma. Theme UI uses custom JSX functions and JSX import source comments to allow you to style elements with values from your...
Read more >What is JSX pragma? - Gatsby
Theme UI uses a custom JSX pragma to add support for Theme UI's sx prop, which is used to style elements by referencing...
Read more >Pragma — Zuul documentation
It is used to alter how the configuration is processed while loading. A pragma item only affects the current file. The same file...
Read more >What does JSX compile to? · Stupidly Simple
In TypeScript, this transform makes use of the jsxFactory and jsxFragmentFactory configuration options. jsxFactory can be changed on a per-file ...
Read more >HTML Standard
3 Semantics, structure, and APIs of HTML documents ... client-side scripts or server-side site-wide scripts to process using the data-*="" attributes.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
okay @adamsoffer, I mostly use
sx
and always TypeScript 😄 Feel free to@
me when you encounter problems like this.Thanks for this comment! That’s actually something we need to cover in the docs.
Previously,
sx
was added to global JSX types, so it was super easy to conflict with other libraries. Right now, we’re exporting JSX namespace, and TypeScript addssx
prop when it sees the pragma comment.That’s nice, because we’re not polluting global JSX namespace anymore, but this means that if you configure Babel to support
sx
everywhere you need to addsx
manually to React types.You need to add the following to one of your files.
css
prop globally — https://emotion.sh/docs/emotion-11#css-prop-typesWe’ll add an entry point similar to
@emotion/react/types/css-prop
before a stable release, so it’s going to be a bit more convenient to use.I could try something, will PR on the pragma page