
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-reactive-class
Advanced tools
With React Reactive Class, you can create Reactive Components, which listen to events and re-render themselves.
react-reactive-class
comes with a set of reactive DOM elements (button, div, span, etc) and a function to wrap your component to be a Reactive Component.
Once you created a Reactive Component, you pass a props provider
to it, and it will listen to the provider, when the provider emits new props, Reactive Component will re-render itself.
You can use Event Emitter or Rx.Observable as props provider
.
npm install --save react-reactive-class
import React from 'react';
import {EventEmitter} from 'events';
import Rx from 'rx';
import {dom} from 'react-reactive-class';
const {div:Xdiv} = dom;
window.ee = new EventEmitter();
window.props$ = new Rx.Subject();
class App extends React.Component {
render() {
console.log('App rendered.');
return (
<div>
<Xdiv ee={window.ee}>Will listen to Event Emitter</Xdiv>
<Xdiv ee={window.props$}>Will subscribe to Rx.Observable</Xdiv>
</div>
);
}
}
React.render(<App />, document.getElementById('app'));
// notice that App will not re-render, nice!
window.ee.emit('props', {children: 'Awesome!'});
window.ee.emit('props', {style: {color: 'red'}});
window.props$.onNext({style: {color: 'blue'}});
// you can open your console and play around
class Text extends React.Component {
render() {
console.log('Text rendered.');
return (
<div>{this.props.children}</div>
);
}
}
const XText = reactive(Text);
@reactive
class XText extends React.Component {
render() {
console.log('Text rendered.');
return (
<div>{this.props.children}</div>
);
}
}
By default, the props provider attribute is ee
and Reactive Component will listen to props
event. You can custom those values.
Event name has no effect when using Rx.Observable as props provider.
const XText = reactive(Text, 'awesomeProvider', 'new-props');
<XText awesomeProvider={window.ee} />
window.ee.emit('new-props', {children: 'Awesome!'});
@reactive('awesomeProvider', 'new-props')
class XText extends React.Component { ... }
Feel free to ask questions or submit pull requests!
The MIT License (MIT)
FAQs
create reactive react classes
The npm package react-reactive-class receives a total of 1 weekly downloads. As such, react-reactive-class popularity was classified as not popular.
We found that react-reactive-class 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.