
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
react-controlled
Advanced tools
higher-order-component for react controlled components
npm install --save react-controlled
import React from 'react';
import controlled from 'react-controlled';
class MyComponent extends React.Component {
onClickSave = () => {
const nickname = this.props.fields('nickname').value;
const age = this.props.fields('age').value;
}
render() {
return <div>
<input type="text" {...this.props.fields('nickname')}/>
<input type="text" {...this.props.fields('age')}/>
<button onClick={this.onClickSave}>save</button>
</div>;
}
}
export default controlled(MyComponent)
It is recommanded to set default value at constructor.
import React from 'react';
import controlled from 'react-controlled';
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.props.fields({
fieldName: 'nickname',
defaultValue: 'no name',
});
}
render() {
return <div>
<input type="text" {...this.props.fields('nickname')}/>
</div>;
}
}
export default controlled(MyComponent)
default getValue function: args => args[0].target.value
import React from 'react';
import controlled from 'react-controlled';
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.props.fields({
fieldName: 'nickname',
getValue: args => args[0],
});
}
render() {
return <div>
<SomeComponent {...this.props.fields('nickname')}/>
</div>;
}
}
export default controlled(MyComponent)
import React from 'react';
import controlled from 'react-controlled';
class MyComponent extends React.Component {
onClick = () => {
const values = this.props.getFieldValues();
values.nickname = 'my name is ' + values.nickname;
values.age = 'my age is ' + values.age;
this.props.setFieldValues(values);
}
render() {
return <div>
<input type="text" {...this.props.fields('nickname')}/>
<input type="text" {...this.props.fields('age')}/>
<button onClick={this.onClick}>example</button>
</div>;
}
}
export default controlled(MyComponent)
FAQs
Useful higher-order-component for react controlled components
The npm package react-controlled receives a total of 1 weekly downloads. As such, react-controlled popularity was classified as not popular.
We found that react-controlled 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.