Simple, reusable, and effective UI logic components and hooks for React.
A collection of minimalist, logic-focused React components and hooks that serve as foundational building blocks for building clean, composable user interfaces.
- 🧩 Composable – Designed to be used together or standalone.
- ⚡ Lightweight – No dependencies, just plain React.
- 🔁 Reusable – Common UI logic patterns like conditional rendering, toggles, and guards.
- 💡 Declarative – Keeps your JSX expressive and maintainable.
- ❤️ Zero Installation – No setup required, just import and use.
A lightweight conditional rendering component that renders its children when a condition is truthy. You can provide a fallback to render when the condition is falsy.
| Name | Type | Description |
|---|---|---|
when |
T | undefined | null | false |
The condition to determine whether to render the children. |
children |
ReactNode | ((item: T) => ReactNode) |
The content to render when when is truthy. Can be a render function. |
fallback |
ReactNode |
(Optional) Fallback to render when when is falsy. Default is null. |
import { RenderIf } from "@components";
const Example = () => {
const user = { name: "John Doe" };
return (
<RenderIf when={user} fallback={<div>No User Found</div>}>
<div>Hello, {user.name}!</div>
</RenderIf>
);
};A developer utility component that displays the current screen width, height, and Tailwind-style screen size label (e.g., SM, MD, LG, etc.). It updates live on window resize and renders as a fixed element on the screen.
Useful during development to quickly inspect responsive breakpoints in real-time.
- Shows current screen
width x height - Displays responsive label:
XS,SM,MD,LG,XL,2XL - Auto-updates on window resize
- Tailwind CSS-based visibility logic
import { ScreenSize } from "@components";
const App = () => {
return (
<div>
<ScreenSize />
<p>Resize the window to see dimensions and breakpoint label update.</p>
</div>
);
};A custom hook that provides a function to copy text to the clipboard and manages the copy state.
import { useCopyToClipboard } from "@hooks";
const App = () => {
const { isCopied, copyToClipboard } = useCopyToClipboard();
return (
<div>
<button onClick={() => copyToClipboard("Hello, World!")}>
Copy to Clipboard
</button>
{isCopied && <span>Copied!</span>}
</div>
);
};A custom hook that runs a function when the component mounts. It is useful for performing side effects like data fetching or subscriptions.
import { useMountEffect } from "@hooks";
const App = () => {
useMountEffect(() => {
console.log("Component mounted");
});
return <div>Hello, World!</div>;
};A custom hook that runs a function when the component unmounts. It is useful for cleanup tasks like unsubscribing from events or cancelling requests.
import { useUnMountEffect } from "@hooks";
const App = () => {
useUnMountEffect(() => {
console.log("Component unmounted");
});
return <div>Hello, World!</div>;
};A custom hook that debounces a value, returning the debounced value after a specified delay. This is useful for optimizing performance in scenarios like search inputs or live updates.
import { useDebounce } from "@hooks";
const App = () => {
const { value, debouncedValue, setValue } = useDebounce(inputValue, 500);
return (
<div>
<input
type="text"
value={value}
onChange={(e) => setValue(e.target.value)}
placeholder="Type something..."
/>
<p>Debounced Value: {debouncedValue}</p>
</div>
);
};