Skip to content

jherr/vanilla-jsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vanilla-jsx

A thought experiment in using the JSX parser to create vanilla DOM elements. So instead of something like this:

document.getElementById('test').innerHTML = `<div>...<div>`;

Or this:

const myDiv = document.createElement('div');
myDiv.className = 'foo';
myDiv.setAttribute('blah', 'baz');
document.getElementById('test').appendChild(myDiv);

You could do this:

/** @jsx dom */
import dom from 'something';

document.getElementById('test').appendChild(
  <div>
    Foobar
    ...
    <span>Blah</span>
    {someArray.map(elem => <div>{elem}</div>)}
  </div>
);

About

Using JSX to create DOM elements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published