
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
compound-builder
Advanced tools
It's small but powerful. You can build compound components with declarative code.
Also, it supports type safety as shown in the picture below.
| 🕹 Demo Repository 🕹 |
|---|
| Sample Counter |
import { compoundBuilder } from "compound-builder";
import constate from "constate";
import useSampleLayout from "./index.hook";
import { SampleBody, SampleFooter, SampleHeader } from "./index.style";
export const [SampleProvider, useCount, useCountIncrement, useCountDecrement] =
constate(
useSampleLayout,
(value) => value.count,
(value) => value.increment,
(value) => value.decrement
);
const SampleLayout = compoundBuilder(SampleProvider, {
// You can specify any key you want. (e.g. chicken, pizza)
Header: SampleHeader,
Body: SampleBody,
Footer: SampleFooter,
});
export default SampleLayout;
When used as shown above, the developed compound component will be affected by the Sample Provider context. This means that you can access the context through hooks like useCount.
import SampleLayout from "@/components/Organisms/layouts/sample";
import CounterSection from "@/components/Organisms/sections/sample/CounterSection";
const SamplePage = () => {
return (
<SampleLayout>
<SampleLayout.Header>
<SampleHeaderSection />
</SampleLayout.Header>
<SampleLayout.Body>
<CounterSection />
</SampleLayout.Body>
<SampleLayout.Footer>
<SampleFooterSection />
</SampleLayout.Footer>
</SampleLayout>
);
};
export default SamplePage;
npm:
npm i compound-builder
Yarn:
yarn add compound-builder
compoundBuilder<T>(wrapperComponent, Record<string, React.component<T>)If you add sub-components to the compound component to be specified, you can handle the types as they are when using them.
If you find a bug, please create an issue providing instructions to reproduce it. It's always very appreciable if you find the time to fix it. In this case, please submit a PR.
If you're a beginner, it'll be a pleasure to help you contribute. You can start by reading the beginner's guide to contributing to a GitHub project.
When working on this codebase, please use yarn. Run yarn examples to run examples.
MIT © KZ-Lucas
FAQs
Easy-to-use compound builder.
The npm package compound-builder receives a total of 3 weekly downloads. As such, compound-builder popularity was classified as not popular.
We found that compound-builder 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.