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-zeroconfig-components
Advanced tools
React components that require (almost) zero configuration.
For Stripe payments etc, see https://github.com/tomsoderlund/react-zeroconfig-payments
yarn add react-zeroconfig-components # or: npm install react-zeroconfig-components
button
where applicableStyling is optional, CSS files are included but you can also use styled-components
or similar.
How to import CSS file, example:
import '../node_modules/react-zeroconfig-components/dist/TokenList.css'
There are three groups of components:
{ name, value }
and renders a list or a menu.See the Storybook stories in /stories
to see how the components are used in code, including more advanced use cases.
import { List } from 'react-zeroconfig-components'
<List
values={arrayOfObjects}
numbered={false}
customFormat={optionalCustomFormat}
/>
const optionalCustomFormat = (row, index) => {
/* return formatted value */
}
<Table
values={arrayOfObjects}
customFormat={optionalCustomFormat}
/>
const optionalCustomFormat = (field, value, rowIndex, columnIndex) => {
/* return formatted value */
}
<RadioButtons
options={arrayOfStringsOrObjects}
value={currentValue}
onChange={value => handleChange(value)}
/>
<SelectDropdown
options={arrayOfStringsOrObjects}
value={currentValue}
onChange={value => handleChange(value)}
/>
<SelectMenu
options={arrayOfStringsOrObjects}
value={currentValue}
onChange={value => handleChange(value)}
/>
<TabMenu
options={arrayOfStringsOrObjects}
value={currentValue}
onChange={value => handleChange(value)}
/>
Advanced example:
<TabMenu
options={arrayOfStringsOrObjects}
value={currentValue}
onChange={handleChange}
elementType='nav'
customChild={MyCustomComponent}
/>
<TokenList
options={arrayOfStringsOrObjects}
value={currentValue}
onSelect={token => handleSelect(token)}
onRemove={token => handleRemove(token)}
/>
<ToggleSwitch
value={currentValue}
onChange={value => handleChange(value)}
/>
<TokenInput
options={arrayOfStringsOrObjects}
value={smallerArrayOfStringsOrObjects}
onAdd={handleAdd}
onRemove={handleRemove}
/>
<TokenSearchInput
value={arrayOfStringsOrObjects}
onSearch={async (searchText) => { return foundMatch }}
onAdd={handleAdd}
onRemove={handleRemove}
placeholder='Type here to search'
canAddAny={true}
/>
<SearchInput
onSearch={async (searchText) => { return foundMatch }}
onSubmit={handleSubmit}
placeholder='Type here to search'
canSubmitAny={true}
/>
<EditInPlace
placeholder='Edit headline'
value={article.headline}
onChange={headline => updateArticle({ headline })}
canEdit={!!user}
style={{ fontSize: '2.5em' }}
>
<h1>{article.headline}</h1>
</EditInPlace>
<ListCard
name='Sam Lowry'
details='Main character'
imageUrl='https://pbs.twimg.com/profile_images/943955598718017536/XVuOSUzc_400x400.jpg'
>
<button>Edit</button>
<button>Delete</button>
</ListCard>
<Card
layer={0}
visible={isVisible}
onClose={event => setIsVisible(!isVisible)}
>
(...content...)
</Card>
<Card
layer={1}
...
/>
onAdd
onChange
onClose
onRemove
onSearch
onSelect
onSubmit
yarn new
Preview components in Storybook:
yarn storybook
...then open http://localhost:6006/ in your browser.
yarn publish # yarn prepare (Babel) will be run automatically
React Hook order error:
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.
Solution: check if conflicting versions:
yarn list react # or npm ls react
FAQs
React components that require zero configuration.
The npm package react-zeroconfig-components receives a total of 2 weekly downloads. As such, react-zeroconfig-components popularity was classified as not popular.
We found that react-zeroconfig-components 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.