Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
lazy-input
Advanced tools
Readme
A lazy React.js input field that only updates when it is told to re-render (fixes issues with Flux backed field data)
Using input elements with Flux can be a pain because actions are asynchronous. Triggering an action in the onChange
handler will cause React's default input
component to re-render the original value miliseconds before the new value arrives from the store.
LazyInput solves this problem by keeping an internal state for value
and only updates that state when given new props, and then only after a lazyLevel
has lapsed (default 1s). Otherwise, it works exactly like input
. Well, almost. . .
LazyInput expands the type
prop slightly to accept textarea
in addition to the normal input
types. We chose to do it this way because it seemed better than maintaining two packages (LazyInput and LazyTextarea), having lazy-input/input
and lazy-input/textarea
require statements, or having LazyInput.input
and LazyInput.textarea
.
var LazyInput = require('lazy-input');
// ...
render: function() {
return (
<div>
// an input element
<LazyInput type="text" value="some value" onChange={this.onChange} />
// a test area element
<LazyInput type="textarea" value="some value" onChange={this.onTextAreaChange} />
</div>
);
}
LazyInput can also accept any React Component as the type. For example, if you are using the react-input-placeholder to get placeholder working in older browsers (ex. IE9), then you can pass through the input component directly. There is plenty of rope here to hang yourself though, so be careful.
var Input= PlaceholderShim.input;
// ...
<LazyInput type={Input} value="some value" onChange={this.onChange} />
Installing via npmjs
npm install --save lazy-input
Using
LazyInput = require('lazy-input');
// ...
<LazyInput type="text" value={this.state.myFluxValue} onChange={this.onChange} />
git clone https://github.com/HurricaneJames/lazy-input.git
cd lazy-input
npm install
npm run examples
open localhost:8090
v2.0 - Updated to support React 15.x, added examples
v1.1 - LazyInput types can now include any React Component class. Thanks go to Riku Rouvila.
FAQs
A lazy React.js input field that only updates when it is told to re-render (fixes issues with Flux backed field data)
The npm package lazy-input receives a total of 16 weekly downloads. As such, lazy-input popularity was classified as not popular.
We found that lazy-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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.