
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
babel-plugin-react-v-html
Advanced tools
Babel plugin for React component to transform the JSXAttribute from v-html to dangerouslySetInnerHTML.
Babel plugin for React component to transform the JSXAttribute from v-html to dangerouslySetInnerHTML.
$ npm install babel-plugin-react-v-html --save-dev
When you use of the innerHTML in React, you usually use the dangerouslySetInnerHTML of JSXAttribute. But it is too long and complex, like this
class App extends React.Component{
constructor(props){
super(props);
this.state = {
html: `<h1>dangerouslySetInnerHTML is bad</h1>`
}
}
render() {
const html = this.state;
return (
<div dangerouslySetInnerHTML={{__html: html}} />
)
}
}
It's so troublesome, although It wants to warn you the innerHTML is dangerous because the innerHTML can open you up to a cross-site scripting (XSS) attack.
So, this plugin is born to resolve this problem.
With this plugin, you can easily code.
Instead,
class App extends React.Component{
constructor(props){
super(props);
this.state = {
html: `<h1>v-html is awesome</h1>`
}
}
render() {
const html = this.state;
return (
<div v-html={html} />
)
}
}
Write via babelrc.
// .babelrc
{
"plugins": [
"react-v-html"
]
}
FAQs
Babel plugin for React component to transform the JSXAttribute from v-html to dangerouslySetInnerHTML.
We found that babel-plugin-react-v-html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.