
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
with-rematch
Advanced tools
🕶 A HoC that implement reducer a la Rematch
Inpired By Rematch.js ♡
npm install -g with-rematch
or
yarn add with-rematch
const model = {
state: 0,
reducers: {
increment(state, payload, props) {
console.log(state); // the state
console.log(payload); // the payload passed via action
console.log(props); // component props
return state + (payload || 1);
},
decrement(state, payload, props) {
return state - (payload || 1);
}
},
effects: actions => ({
async asyncIncrement(payload, state, props) {
await new Promise(resolve => setTimeout(resolve, 1000));
actions.increment();
}
}),
lifecycle: {
componentDidMount() {
console.log('componentDidMount', this);
}
}
};
Understanding models is as simple as answering a few questions:
Actions is how we trigger reducers & effects in your models. actions
props standardizes your actions without the need for writing action types or action creators.
// reducers
actions.increment();
actions.increment(5);
actions.decrement(2);
// effects
actions.asyncIncrement(10);
const Counter = ({state, actions}) => (
<div>
Value: {state}
<button onClick={actions.increment}>INCREMENT</Button>
<button onClick={actions.decrement}>DENCREMENT</button>
<button onClick={actions.asyncIncrement}>ASYNC INCREMENT</button>
<button onClick={() => actions.increment(5)}>INCREMENT 5</Button>
</View>
);
export default withRematch(model)(Counter);
TODO
import withRematch from 'with-rematch';
const model = {
state: 0,
reducers: {
increment(state, payload, props) {
console.log(state); // the state
console.log(payload); // the payload passed via action
console.log(props); // component props
return state + (payload || 1);
},
decrement(state, payload, props) {
return state - (payload || 1);
}
},
effects: actions => ({
async asyncIncrement(payload, state, props) {
await new Promise(resolve => setTimeout(resolve, 1000));
actions.increment();
}
}),
lifecycle: {
componentDidMount() {
console.log('componentDidMount', this);
}
}
};
const Counter = ({state, actions}) => (
<div>
Value: {state}
<button onClick={actions.increment}>INCREMENT</Button>
<button onClick={actions.decrement}>DENCREMENT</button>
<button onClick={actions.asyncIncrement}>ASYNC INCREMENT</button>
<button onClick={() => actions.increment(5)}>INCREMENT 5</Button>
</View>
);
export default withRematch(model)(Counter);
FAQs
A HoC that implement reducer a la Rematch
The npm package with-rematch receives a total of 4 weekly downloads. As such, with-rematch popularity was classified as not popular.
We found that with-rematch 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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.