Using JSX with Bel
See original GitHub issueI was wondering if its possible to use JSX instead of hyperx to create elements with Bel. I like to use Bel and Yo-yo, but sometimes its convenient to go JSX route, because then components could be re-used between Yo-yo/Choo and React projects.
I tried to set jsx pragma
to h
and then use it like so:
var h = require('bel').createElement
var el = <h1 class="a">Hi</h1>
document.body.appendChild(el)
But children (Hi
) never appear, and if you omit class
, bel complaints: Cannot read property 'namespace' of null
. Got confused, probably missing something.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Bel vs JSX | What are the differences? - StackShare
It is a spec for a new dialect of Lisp, written in itself. It is a language with expressive power, clarity, and efficiency....
Read more >Elements & JSX | React - ReScript
Elements are the smallest building blocks of React apps. This page will explain how to handle React.element s in your React app with...
Read more >babel/preset-react
Replace the component used when compiling JSX fragments. useBuiltIns. boolean , defaults to false . Will use the native built-in instead of ...
Read more >Belle - Configurable React Components with great UX
Belle provides you with a set of React components like Toggle, ComboBox, Rating, TextInput, Button, Card, Select and soon many more.
Read more >Use <code> or similar tags in ReactJS using JSX
Explanation: Parsing your input starts at <pre> in JSX mode. The opening bracket { switches the parser into JavaScript mode to include computed...
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 Free
Top 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
Sometimes I have wished that all the
h
modules were more interoperable. They all have slight differences that make them incompatible. bel, virtual-hyperscript, hyperscript, and react all have slight differences, though they do basically the same thing.kinda such thing
seems to be working
examples
Ahref, not using
props
argument directly (important to test both above and below cases!)MOAR