Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Use JSX for creating DOM elements.
npm install --save jsx-dom
// Using React namespace, works with most transpilers directly
import * as React from 'jsx-dom';
// Or: Using a custom namespace, see the paragraph below.
import * as jsxDom from 'jsx-dom';
document.body.appendChild( <div id="hello" /> );
If you prefer jsx-dom
not to occupy the React namespace,
you need to provide the module name as pragma with your Babel settings, specifically within your .babelrc
:
{
"plugins": [
[ "transform-react-jsx", "jsxDom" ]
]
}
jsx-dom
is based on the React JSX syntax with a few additions:
class
is supported as an attribute as well as className
class
can take an array of strings (and booleans, but they will be filtered out automatically) or an object with the format { [key: string]: boolean }
.style
accepts both strings and objects.dataset
accepts an object.on
and has a function value will be treated as an event listener and thus attached to the node.innerHTML
, innerText
and textContent
are accepted.jsx-dom
requires Object.keys
and Object.assign
(an ES6 feature). If you are using Babel, the transform-object-assign
plugin should eliminate the need for a polyfill.
FAQs
JSX to document.createElement.
The npm package jsx-dom receives a total of 4,866 weekly downloads. As such, jsx-dom popularity was classified as popular.
We found that jsx-dom demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.