Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-curry
Advanced tools
inspired by curry in functional programming
because react component always contains only one parameter which is props, my curry function's work is to deep merge props.
npm install --save react-curry
import React from 'react';
import curry from 'react-curry';
const BlueDiv = curry('div', {style: {backgroundColor: 'blue'}});
// Now you get a blue div component;
React.render(
<BlueDiv>
I am a blue div
</BlueDiv>,
document.getElementById('root')
);
import React from 'react';
import curry from 'react-curry';
// let us create a simple component which compose img and span
const ImageAndText = ({size, text, imgSrc}) => (
<div style={{width: size.width, height: size.height}}>
<img src={imgSrc}/>
<span>{text}</span>
</div>
);
// Now you get a size fixed ImageAndText component
const SqureImageAndText curry(ImageAndText, {
size: {
width: '100px',
height: '100px'
}
});
// u can use it;
React.render(
<SqureImageAndText imgSrc="https://www.google.com.hk/search?safe=strict&site=&q=%E5%85%83%E5%AE%B5%E8%8A%82&oi=ddle&ct=lantern-festival-2017-china-hong-kong-5653647470886912-hp&hl=zh-CN&sa=X&ved=0ahUKEwixx7mn0YfSAhVIoZQKHTzEAR0QPQgE" text="hello world" />,
document.getElementById('root')
);
using lodash merge function, will remove this dependency if stars more than 200 react
FAQs
react stateless component curry
We found that react-curry 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.