Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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 {ObserverComponent, createConnect} from 'urc'
class MyObserverComponent<Props, State, Context, Element> extends ObserverComponent<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: MyObserverComponent
})
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.7 (2018-03-15)
<a name="1.0.6"></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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.