How to retrieve params in `createServerAction$`?
Is there a clever way to retrieve the params in a
createServerAction$
besides passing it as a parameter or FormData attribute?
8 Replies
up? ๐
does useParams() not work?
I don't think so. I can't use useParams() in server action, and if I declare it outside and try to use it, I get a closure issue (params not defined).
Too bad we don't have access to
params
. We do have access to request
though in the ActionEvent
:
I wonder why we don't have params there.In that case, you need the request object's url part parsed through new URL(). The resulting objects has searchParams as a property.
True ๐ I wanted to be sure I don't miss something, I feel having params there would be handy ๐
Unknown Userโข2y ago
Message Not Public
Sign In & Join Server To View
I did ๐ As a discussion: https://github.com/solidjs/solid-start/discussions/551
GitHub
Access
params
in createServerAction$
? ยท Discussion #551 ยท solid...The same way we have access to request, it would be nice to have access to params as well: -const [create, { Form }] = createServerAction$(async (formData: FormData, { request }) => { +const...
I feel I spammed the discussions section recently, but I spent the weekend trying Solid. Loving it so far!
Except the i18n. I didn't manage to make the primitives package work around SolidStart... yet!