
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-announce-connect
Advanced tools
A react-announce declarative that applies an observable onto the component state.
npm i react-announce-connect --save
The following example will display the time and get updated every 100ms.
import {connect} from 'react-announce-connect'
import {Observable} from 'rx'
import {Component} from 'react'
const time = Observable.interval(100).map(() => new Date())
@connect({time})
class Timer extends Component {
render () {
return (
<div>{this.state.time}</div>
)
}
}
Creating responsive Layouts. This will auto select the font-size based on the screen size.
import {connect} from 'react-announce-connect'
import {Observable} from 'rx'
import {Component} from 'react'
const windowEvents = Observable.fromCallback(window.addEventListner)
const _screen = windowEvents('resize')
.debounce(300)
.pluck('target', 'innerWidth')
.map(x => {
if(x < 768){ return 'xs' }
if(x < 992){ return 'sm' }
if(x < 1200){ return 'md' }
return 'lg'
})
/*
You can create a new reusable decorator for screen size
*/
const screen = connect({screen: _screen})
@screen
class Heading extends Component {
render () {
const style = {fontSize: {xs: 10, sm: 12, md: 14, lg: 18}[this.state.screen]}
return (
<div style={style}>Hello World!</div>
)
}
}
A reusable screen decorator can be created from the connect decorator.
The connect declarative can connect to multiple stream as follows —
@connect({key1: stream1, key2: stream2})
class MyComponent extends React {
...
}
Whenever either of the streams viz — stream1 or stream2, emit a value, it would be applied to the state property key1 and key2 respectively.
The @connect declarative, optimizes internally so that the state doesn't get updated unless there is an actual change in the value. For instance, if a stream keeps emiting the same value again and again, unless the value changes, the state will not be updated.
FAQs
apply a stream object to the component stream
We found that react-announce-connect 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.