Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Helpers for creating tools like react-redux, mobx-react with minimal boilerplate.
import {createConnect} from 'urc'
import createMobxAtom from 'urc/createMobxAtom'
import {observable, Reaction} from 'mobx'
import React from 'react'
const connect = createConnect({
ReactAtom: createMobxAtom(Reaction),
BaseComponent: React.Component
})
class Store {
@observable name = 'test'
}
const store = new Store()
const MyPureComponent = connect(() =>
<div>
{store.name}
<br/>
<input value={store.name} onInput={({target}) => store.name = target.value}/>
</div>
)
// or
@connect class MyComponent extends React.Component {
render() {
// ...
}
}
Connected component calls renderError if exception throwed in render.
// ...
function renderError({error, children}) {
return <div>
<pre>{error.stack.toString()}</pre>
</div>
}
const connect = createConnect({
ReactAtom: createMobxAtom(Reaction),
BaseComponent: React.Component,
renderError
})
const MyPureComponent = connect(() => {
throw new Error('test')
})
import {AtomizedComponent, createConnect} from 'urc'
class MyAtomizedComponent<Props, State, Context, Element> extends AtomizedComponent<Props, State, Context, Element> {
static instance: number
componentWillMount() {
super.componentWillMount()
const cns: Function = this.constructor
if (cns.instance === undefined) cns.instance = 0
cns.instance++
}
componentWillUnmount() {
this.constructor.instance--
super.componentWillUnmount()
}
__value(isPropsChanged: boolean) {
const value = super.__value(isPropsChanged)
return value
}
_getContext(key: Function, propsChanged: boolean): Context {
return this.context
}
}
const connect = createConnect({
ReactAtom: createMobxAtom(Reaction),
BaseComponent: React.Component,
MixinComponent: MyAtomizedComponent
})
const MyPureComponent = connect(() => {
// ...
})
import {createConnect} from 'urc'
import {mem, ReactAtom} from 'lom_atom'
import React from 'react'
const connect = createConnect({
ReactAtom,
BaseComponent: React.Component
})
class Store {
@mem name = 'test'
}
const store = new Store()
const MyPureComponent = connect(() =>
<div>
{store.name}
<br/>
<input value={store.name} onInput={({target}) => store.name = target.value}/>
</div>
)
1.0.3 (2018-03-09)
<a name="1.0.2"></a>
FAQs
Universal react connect decorator builder
The npm package urc receives a total of 3 weekly downloads. As such, urc popularity was classified as not popular.
We found that urc 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
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.