
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
babel-plugin-react-v-model
Advanced tools
Babel plugin for React component to add a syntactic sugar like Vue's v-model.
$ npm install babel-plugin-react-v-model --save-dev
When you are building a input in React component, usullay, you have to write two JSXAttributes (value and onChange) to Two-WayDataBinding, like this.
class App extends React.Component{
constructor() {
super();
this.state = {
text: ''
};
}
render() {
const {text} = this.state;
return (
<div>
<input
type="text"
value={text}
onChange={(e) =>
this.setState({
text: e.target.value
})
}
/>
</div>
)
}
}
it looks simple, but if It is not a single input instead of a large number of inputs,It will be very troublesome. So, this plugin is born to resolve these thorny problems. With this plugin, you can easily code.
For instance,
class App extends React.Component{
constructor() {
super();
this.state = {
text: '',
num: 1,
radioVal: 1,
checkboxVal: true,
selectVal: 'A'
};
}
render() {
const {text, num, radioVal, checkboxVal, selectVal} = this.state;
const {storeData, setItem} = this.props;// Store Supported
return (
<div>
<input
type="text"
v-model={text}
/>
<textarea
v-model={text}
/>
<label>
<input
type="radio"
name="radio"
value={0}
v-model={radioVal}
/>
<input
type="radio"
name="radio"
value={1}
v-model={radioVal}
/>
</label>
<input
type="checkbox"
v-model={checkboxVal}
/>
<select
v-model={selectVal}
>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
<input
type="number"
v-model={{
bind: num,
filter(val) {
return (val > 0)? val : 0
}
}}
/>
<input
type="text"
v-model={{
bind: storeData,
handler: setItem
}}
/>
</div>
)
}
}
Write via babelrc.
// .babelrc
{
"plugins": [
"react-v-model"
]
}
FAQs
React v-model transform
We found that babel-plugin-react-v-model 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 Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.