Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 601 Bytes

File metadata and controls

27 lines (18 loc) · 601 Bytes
title useAction

useAction allows an action to be invoked programmatically.

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

const updateName = useAction(updateNameAction);

const result = updateName("John Wick");

:::info[Note] useAction requires client-side JavaScript and is not progressively enhanceable. :::

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.