Skip to content

Commit

Permalink
Merge branch 'main' into update-middleware-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Jan 11, 2025
2 parents b94f07d + 83f039a commit c53bca2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/routes/solid-router/reference/data-apis/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"create-async.mdx",
"create-async-store.mdx",
"query.mdx",
"use-action.mdx",
"use-submission.mdx",
"use-submissions.mdx"
]
Expand Down
28 changes: 28 additions & 0 deletions src/routes/solid-router/reference/data-apis/use-action.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: useAction
---

`useAction` allows an [`action`](/solid-router/reference/data-apis/action) to be invoked programmatically.

```tsx
import { useAction } from "@solidjs/router";
import { updateNameAction } from "./actions";

const updateName = useAction(updateNameAction);

const result = updateName("John Wick");
```

<Callout type="info" title="Note">
`useAction` requires client-side JavaScript and is not progressively
enhanceable.
</Callout>

## Parameters

- `action`: The action to be invoked.

## Returns

`useAction` returns a function that invokes the action.
It shares the same signature as the action itself.

0 comments on commit c53bca2

Please sign in to comment.