S
SolidJS12mo ago
michael

How to wait for the value from a useAction?

I am using useAction with a server action, but when I call the action it is returning a Promise, how do I wait for the Promise and display the result?
1 Reply
michael
michaelOP12mo ago
Oh seems like I was supposed to use cache rather than an action, and then I use createAsync calling the cache? no, personally I needed to use an action because of CORS, but createAsync answers my original question.
const check = useAction(checkWhitepaper);
const result = createAsync(() => check(hostname));
const check = useAction(checkWhitepaper);
const result = createAsync(() => check(hostname));
oh seems like you can also "use server" in cache oh you can also do it in an async function and use createResource I am learning so much! not sure what the difference between all 3 ways is
Want results from more Discord servers?
Add your server