@citrus327/with-default-props
v1.0.0
Published
a HOC that applies default props to React component
Downloads
2
Readme
@citrus327/with-default-props
a HOC that applies default props to React component
Installation
pnpm install @citrus327/with-default-props
Usage
import { withDefaultProps } from '@citrus327/with-default-props'
interface SimpleProps {
word?: string
}
export const Simple: React.FC<SimpleProps> = (props) => {
return <h1>Hello{props.word}</h1>
}
const Wrapped = withDefaultProps(Simple, {
word: " world",
})