Data APIs

useAction

Edit this page

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");

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.

Report an issue with this page