You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError(`Seems like you are directly calling a function wrapped in "action". To properly use an action, you will need to first call "useAction".
65
+
66
+
So, if you have code like this:
67
+
68
+
1 const myFunc = action(...);
69
+
2
70
+
3 / function MyComponent() {
71
+
4 | return <button
72
+
5 | onClick={() => myFunc(...)}
73
+
|____________________^ This is where the error is going to happen
74
+
6 >
75
+
7 Click me!
76
+
8 </button>
77
+
9 }
78
+
79
+
You will need to change it to something like:
80
+
81
+
1 const myAction = action(...);
82
+
2
83
+
3 function MyComponent() {
84
+
4 const callMyAction = useAction(myAction);
85
+
5
86
+
6 return <button
87
+
7 onClick={() => callMyAction(...)}
88
+
8 >
89
+
9 Click me!
90
+
10 </button>
91
+
11 }
92
+
93
+
This is the case because the action will need to tune itself to the surrounding context for the Router so that it can
94
+
keep track of all the submissions. See https://docs.solidjs.com/solid-router/concepts/actions#creating-actions for more information on how to use actions.
0 commit comments