Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
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.new
call.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 7,629 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.