
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
babel-plugin-jsx-factory
Advanced tools
babel plugin for jsx handled by a function h(tagName, attributes, children)
Use jsx
with a factory function h
matching this signature:
h(tagName, attributes, children)
For a string tagName
, attributes
object, and an array of children
.
Write some code with inline jsx and a virtual dom factory function, in our case
h
:
var h = require('virtual-dom/h');
var main = require('main-loop');
var loop = main({ n: 0 }, render, require('virtual-dom'));
function render (state) {
return <div>
<h1>clicked {String(state.n)} times</h1>
<button onclick={onclick}>click me!</button>
</div>
function onclick () {
loop.update({ n: state.n + 1 })
}
}
Then make a package.json:
{
"name": "whatever",
"browserify": {
"transform": [
[
"babelify",
{
"jsxPragma": "h",
"plugins": [ "babel-plugin-jsx-factory" ]
}
]
]
},
"dependencies": {
"babelify": "^6.1.3",
"babel-plugin-jsx-factory": "^1.0.0",
"main-loop": "^3.1.0",
"virtual-dom": "^2.0.1"
}
}
To build:
$ browserify main.js > public/bundle.js
var React = require('react')
var App = React.createClass({
getInitialState: function () { return { n: 0 } },
render: function () {
return <div>
<h1>clicked {this.state.n} times</h1>
<button onClick={this.handleClick}>click me!</button>
</div>
},
handleClick: function () {
this.setState({ n: this.state.n + 1 })
}
})
React.render(<App />, document.querySelector('#content'))
Then make a package.json:
{
"name": "whatever",
"browserify": {
"transform": [
[
"babelify",
{
"jsxPragma": "React.createElement",
"plugins": [ "babel-plugin-jsx-factory" ]
}
]
]
},
"dependencies": {
"babelify": "^6.1.3",
"babel-plugin-jsx-factory": "^1.0.0",
"react": "~0.13.3"
}
}
To build:
$ browserify main.js > public/bundle.js
MIT
FAQs
babel plugin for jsx handled by a function h(tagName, attributes, children)
The npm package babel-plugin-jsx-factory receives a total of 3 weekly downloads. As such, babel-plugin-jsx-factory popularity was classified as not popular.
We found that babel-plugin-jsx-factory 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.