Skip to content

Commit

Permalink
docs(jsx): types
Browse files Browse the repository at this point in the history
  • Loading branch information
artalar committed Oct 8, 2024
1 parent 0138776 commit c6efa2f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/jsx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,14 @@ To type your custom component props accepting general HTML attributes, for examp
```tsx
import { type JSX } from '@reatom/jsx'

// allow only plain data types
export interface InputProps extends JSX.InputHTMLAttributes {
defaultValue?: string
}
// allow plain data types and atoms
export type InputProps = JSX.IntrinsicElements['input'] & {
defaultValue?: string
}

export const Input = ({ defaultValue, ...props }: InputProps) => {
props.value ??= defaultValue
Expand Down

0 comments on commit c6efa2f

Please sign in to comment.