
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
react-input
Advanced tools
This is a set of lightweight, dependency free components for building forms in React. There are three components in total:
<Field>
: A wrapper that provides methods to get input values.<Label>
: An optional text label.<Input>
: A textarea, email, text or password input.<Submit>
: A submit button.Right now, only textarea
, password
, email
and text
inputs can be used, but it can be expanded to provide date pickers, checkboxes/switches, selection menus, and file inputs in the future.
npm install react-input
<form onSubmit={this.myFormSubmissionHandler}>
<Field ref="email" name="email">
<Label />
<Input
required
type="email"
placeholder="Name"
/>
</Field>
<Submit />
</form>
For a detailed example, see the example project.
All standard HTML input attributes are supported and can be used as props.
Method | Usage | |
---|---|---|
focus | Input.focus() | Sets the focus on the element. |
value | Input.value() | Returns the value on the element.* |
clear | Input.clear() | Clears the value on the element. |
*Note that you can also change the value of an input directly by `Input.value = 'newValue'
Event | Description |
---|---|
onChange | Runs on change. Includes the name and value of the input. |
Considering this component:
<Field ref="email" name="email">
<Input
type="email"
onChange={::this.handleInputChange}
/>
</Field>
An event handler might look like:
handleInputChange(value, field, event) {
return this.setState({
[field]: value
});
}
As this component does not include CSS styles to use, you will need to add your own styles. If you are using inline styles, just include the style
prop on each component.
The default DOM tree of the component is included below for reference. You can also override the default classes by just using className
like you would normally.
<div class="input-group">
<label class="input-group-label"></label>
<input class="input-group-input">
</div>
Built with care in New Orleans by Patrick Burtchaell.
Copyright 2015 Patrick Burtchaell. Licensed MIT.
FAQs
Easy forms for React
The npm package react-input receives a total of 135 weekly downloads. As such, react-input popularity was classified as not popular.
We found that react-input 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
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.