An open API service indexing awesome lists of open source software.

https://github.com/nickshiro/bind-props

type-safety functional component props binding
https://github.com/nickshiro/bind-props

biome bun npm-package react solid turbo

Last synced: about 2 months ago
JSON representation

type-safety functional component props binding

Awesome Lists containing this project

README

          

# React example

```tsx
import type { FC } from "react";
import clsx from "clsx";
import bindProps from "bind-props-react";

interface ButtonProps {
color: "red" | "blue";
onClick: () => void;
}

const Button: FC = ({ color, ...props }) => {
const classes = clsx(
"rounded-lg",
color === "red" ? "bg-red-200" : "bg-blue-200"
);
return ;
};

const RedButton = bindProps(Button, { color: "red" });

export const App = () => {
return (


console.log("Red button clicked!")} />

);
};
```