File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/routes/solid-router/reference/data-apis Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 6
6
" create-async.mdx" ,
7
7
" create-async-store.mdx" ,
8
8
" query.mdx" ,
9
+ " use-action.mdx" ,
9
10
" use-submission.mdx" ,
10
11
" use-submissions.mdx"
11
12
]
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : useAction
3
+ ---
4
+
5
+ ` useAction ` allows an [ ` action ` ] ( /solid-router/reference/data-apis/action ) to be invoked programmatically.
6
+
7
+ ``` tsx
8
+ import { useAction } from " @solidjs/router" ;
9
+ import { updateNameAction } from " ./actions" ;
10
+
11
+ const updateName = useAction (updateNameAction );
12
+
13
+ const result = updateName (" John Wick" );
14
+ ```
15
+
16
+ <Callout type = " info" title = " Note" >
17
+ ` useAction ` requires client-side JavaScript and is not progressively
18
+ enhanceable.
19
+ </Callout >
20
+
21
+ ## Parameters
22
+
23
+ - ` action ` : The action to be invoked.
24
+
25
+ ## Returns
26
+
27
+ ` useAction ` returns a function that invokes the action.
28
+ It shares the same signature as the action itself.
You can’t perform that action at this time.
0 commit comments