Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing 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
let us make an Original component
when you want write some similar components.
these component show green border when selected
import React from 'react';
import curry from 'react-curry';
// component which will show green border when pass selected = true
const GreenBox = ({selected, InnerComponent, innerProps, size}) => (
<div
style={{
border: selected ? 'solid 2px #1fbd87' : undefined,
width: size.width,
height: size.height,
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}>
{
<InnerComponent selected={selected} {...innerProps} />
}
</div>
);
// Green box with inner text
const TextGreenBox = curry(GreenBox, {
InnerComponent: ({text, selected}) => <p style={{color: selected ? '#1fbd87' : '#666666'}}>{text}</p>,
size: {
height: '42px',
width: '123px'
}
});
// Green box with inner img
const ImgGreenBox = curry(GreenBox, {
InnerComponent: ({imgSrc}) => <img src={imgSrc} style={{ width: '100px' }} />,,
size: {
height: '128px',
width: '128px'
}
});
React.render(
<div>
<TextGreenBox selected={true} innerProps={{text: '西瓜'}}/>
<ImgGreenBox selected={true} innerProps={{imgSrc: 'https://www.google.com.hk/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'}}/>
</div>,
document.getElementById('root')
)
using lodash merge function, will remove this dependency if stars more than 200 react
FAQs
react stateless component curry
The npm package react-curry receives a total of 6 weekly downloads. As such, react-curry popularity was classified as not popular.
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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.