
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
compose-components
Advanced tools
Combine multiple React components (like providers) while maintaining fully typed props support. Up to **10 times faster** than using `cloneElement`.
Combine multiple React components (like providers) while maintaining fully typed props support. Up to 10 times faster than using cloneElement
.
pnpm install compose-components
import { ComposeComponents, composeComponents } from "compose-components";
const App = () => (
<ComposeComponents
renderComponents={composeComponents(
[PaletteProvider, { mode: "light" }],
[LayoutProvider, { layout: "default" }],
[TypographyProvider, { font: "sans" }],
)}
>
<div>App</div>
</ComposeComponents>
);
declare function PaletteProvider({ children }: React.PropsWithChildren<{ mode: "light" | "dark" }>): React.ReactNode;
declare function LayoutProvider({ children }: React.PropsWithChildren<{ layout: "default" | "full" }>): React.ReactNode;
declare function TypographyProvider({ children }: React.PropsWithChildren<{ font: "sans" | "serif" }>): React.ReactNode;
Since cloneElement
is not used, this approach is nearly 10x faster than the version that uses cloneElement
.
compose-components [ main][+][📦 v0.0.0][ v22.6.0]
❯ pnpm benchmark
> compose-components@0.0.0 benchmark
> pnpm -F "./benchmark" run start
> benchmark@0.0.0 start compose-components/benchmark
> tsx ./main.tsx
┌─────────┬────────────────────────┬─────────────┬───────────────────┬──────────┬─────────┐
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │
├─────────┼────────────────────────┼─────────────┼───────────────────┼──────────┼─────────┤
│ 0 │ 'with cloneElement' │ '222,705' │ 4490.229389930139 │ '±0.25%' │ 66812 │
│ 1 │ 'without cloneElement' │ '2,049,821' │ 487.8472469985147 │ '±0.35%' │ 614947 │
└─────────┴────────────────────────┴─────────────┴───────────────────┴──────────┴─────────┘
FAQs
Combine multiple React components (like providers) while maintaining fully typed props support. Up to **10 times faster** than using `cloneElement`.
The npm package compose-components receives a total of 12 weekly downloads. As such, compose-components popularity was classified as not popular.
We found that compose-components 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.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.