New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hire-forms-input

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hire-forms-input

React Component representing an input element.

latest
Source
npmnpm
Version
3.0.5
Version published
Weekly downloads
35
775%
Maintainers
1
Weekly downloads
 
Created
Source

Hire Forms Input

React Component representing an input element.

Value as a property

The <Input />s value isn't an internal state, but is passed as a property! In other words: your app has state and passes it to the <Input />. See the examples.

Examples

Default

render() {
	return (
		<Input
			onChange={this.handleChange.bind(this)}
			placeholder="Enter value..."
			value={this.state.value} />
	);
}

With validation

The onInvalid prop isn't required. If a validator function returns isValid: false and a message string, the message string will be a TextNode of <div className="hire-forms-invalid-message" />.

let validateNumbersOnly = function(value) {
	// Handle validation.
	let re = /^\d+$/;
	let isValid = re.test(value);

	// Return a validator object.
	return {
		isValid: isValid,
		message: isValid ? "" : "Only numbers are allowed."
	};
};

...

handleInvalid(message, value) {

}

...

render() {
	return (
		<Input
			onChange={this.handleChange.bind(this)}
			onInvalid={this.handleInvalid.bind(this)}
			placeholder="Enter value..."
			validate={validateNumbersOnly}
			value={this.state.value} />
	);
}

FAQs

Package last updated on 05 Jul 2018

Did you know?

Socket

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.

Install

Related posts