
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
react-timer-hoc
Advanced tools
A React higher-order timer component
Keep your components simple, testable and composable by using higher-order components. This higher-order timer component will re-render your component at the desire rate (in milliseconds).
This higher-order component takes care of when to call render on your component, so your component has only to care about the rendering logic.
A higher-order component is just a function that takes an existing component and returns another component that wraps it.
Read about higher-order components here (applies to deku as well): Mixins Are Dead. Long Live Composition.
Demo: http://jsbin.com/nalixa/edit?html,js,output
npm install --save react-timer-hoc
Create a new component by wrapping your component with timer
HOC. Alongside the properties you specify, the created component will receive a tick
property, the specified delay
value and a stop
function.
import React from 'react';
import ReactDOM from 'react-dom';
function myComponent({ tick, stop, delay }) {
return <div>Started { tick * delay }ms ago.</div>
}
const Timer1 = timer(1000)(myComponent);
const Timer2 = timer(2000)(myComponent);
ReactDOM.render(
<div>
<Timer1 />
<Timer2 />
</div>,
document.getElementById('app')
);
1.0.4 (2015-11-28)
<a name="1.0.3"></a>
FAQs
A React timer higher-order component
We found that react-timer-hoc 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 Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.