
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
mobx-react-helper
Advanced tools
MobX helper library for React component engine, with TypeScript Class & Decorator supports.
MobX helper library for React component engine, with TypeScript Class & Decorator supports.
SemVer | status | ES decorator | MobX |
---|---|---|---|
>=0.4 | ✅developing | stage-3 (internal use) | >=6.11 |
0.3.x | ❌deprecated | stage-3 | >=6.11 |
<0.3 | ❌deprecated | stage-2 | >=4 <6.11 |
npm i mobx react \
mobx-react \
mobx-react-helper
tsconfig.json
Compatible with MobX 6/7:
{
"compilerOptions": {
"target": "ES6",
"moduleResolution": "Node",
"useDefineForClassFields": true,
"experimentalDecorators": false,
"jsx": "react-jsx"
}
}
source/index.tsx
import { createRoot } from 'react-dom/client';
import { MyComponent } from './Component';
import { session, MyContext } from './store';
createRoot(document.body).render(
<MyContext.Provider value={session}>
<MyComponent />
</MyContext.Provider>
);
source/store.ts
import { createContext } from 'react';
export const session = { email: 'tech-query@idea2.app' };
export const MyContext = createContext(session);
source/Component.tsx
import { computed } from 'mobx';
import { observer } from 'mobx-react';
import { ObservedComponent } from 'mobx-react-helper';
import { session } from './store';
export type MyComponentProps = { prefix: string };
type State = { text: string };
@observer
export class MyComponent extends ObservedComponent<
MyComponentProps,
{ email: string },
State
> {
state: Readonly<State> = { text: '' };
@computed
get decoratedText() {
return (
this.observedProps.prefix +
this.observedState.text +
this.observedContext.email
);
}
render() {
return <p>{this.decoratedText}</p>;
}
}
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import { ObservedComponent, reaction } from 'mobx-react-helper';
@observer
export class MyComponent extends ObservedComponent {
@observable
accessor count = 0;
componentDidMount() {
super.componentDidMount();
// Super method call is required if you have more "did mount" logic below
// Your logic is here...
}
componentWillUnmount() {
super.componentWillUnmount();
// Super method call is required if you have more "will unmount" logic below
// Your logic is here...
}
@reaction(({ count }) => count)
handleCountChange(newValue: number, oldValue: number) {
console.log(`Count changed from ${oldValue} to ${newValue}`);
}
render() {
return (
<button onClick={() => this.count++}>Up count {this.count}</button>
);
}
}
import { observer } from 'mobx-react';
import { FormComponent } from 'mobx-react-helper';
@observer
export class MyField extends FormComponent {
render() {
const { onChange, ...props } = this.props,
{ value, handleChange } = this;
return (
<>
<input
{...props}
onChange={({ currentTarget: { value } }) =>
(this.innerValue = value)
}
/>
<output>{value}</output>
</>
);
}
}
FAQs
MobX helper library for React component engine, with TypeScript Class & Decorator supports.
The npm package mobx-react-helper receives a total of 23 weekly downloads. As such, mobx-react-helper popularity was classified as not popular.
We found that mobx-react-helper demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.