Skip to content

Commit

Permalink
docs(solid): Added instructions with the use directive for solid. (pa…
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankeos authored and sea-grass committed Oct 31, 2024
1 parent 415e41a commit 7d01c26
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function Form() {
});

return (
<form use:form>
<form use:form={form}>
<input type="text" name="email" />
<input type="password" name="password" />
<button type="submit">Sign In</button>
Expand All @@ -71,6 +71,23 @@ function Form() {
}
```

> [!IMPORTANT]
>
> To use the `use-*` directive on **Solid**. [You need to extend the JSX namespace](https://docs.solidjs.com/reference/jsx-attributes/use#use). For example:
```dts
// src/global.d.ts
declare global {
declare module "solid-js" {
namespace JSX {
interface Directives {
form: (node: HTMLFormElement) => void;
}
}
}
}
```

### React/Preact

```jsx
Expand Down

0 comments on commit 7d01c26

Please sign in to comment.