Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
babel-plugin-transform-jsx-to-html
Advanced tools
Transform jsx to html string for better ssr performance.
npm install --save-dev babel-plugin-transform-jsx-to-html
.babelrc
.babelrc
{
"plugins": [
"babel-plugin-transform-jsx-to-html",
"babel/plugin-transform-react-jsx"
]
}
Your component.js
that contains this code:
import { createElement, Component } from 'rax';
class App extends Component {
render() {
return <div className="header" />
}
}
Will be transpiled like this:
import { createElement, Component } from 'rax';
class App extends Component {
render() {
return [{
__html: '<div class="header" />'
}];
}
}
These pre transpiled html can be used in server renderer, like rax-server-renderer
input
<div>
<View />
</div>
output
[{
__html: "<div>"
},
createElement(View, null),
{
__html: "</div>"
}]
input
<div className="container" style={style} onClick={onClick}>
<div>a {props.index}</div>
</div>
output
[{
__html: "<div class=\"container\""
}, {
__attrs: {
style: style,
onClick: onClick
}
}, {
__html: "><div>a "
}, props.index, {
__html: "</div></div>"
}]
FAQs
Transform JSX to HTML.
The npm package babel-plugin-transform-jsx-to-html receives a total of 234 weekly downloads. As such, babel-plugin-transform-jsx-to-html popularity was classified as not popular.
We found that babel-plugin-transform-jsx-to-html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.