How to use Link component with shadcn's select component?
Unanswered
JWW posted this in #help-forum
JWWOP
hi everyone
I want to use select component to put a category param in url to filter a item list, and also I want to keep it server component so I can only use <Link /> to navigate
But I tried wrap <Link /> in <SelectItem /> and wrap <SelectItem /> in <Link />, they both can't work
I want to use select component to put a category param in url to filter a item list, and also I want to keep it server component so I can only use <Link /> to navigate
But I tried wrap <Link /> in <SelectItem /> and wrap <SelectItem /> in <Link />, they both can't work
8 Replies
@JWW hi everyone
I want to use select component to put a category param in url to filter a item list, and also I want to keep it server component so I can only use <Link /> to navigate
But I tried wrap <Link /> in <SelectItem /> and wrap <SelectItem /> in <Link />, they both can't work
all of shadcn components are client
so you arent gaining anything by forcing yourself to use link.
@DirtyCajunRice | AppDir all of shadcn components are client
JWWOP
Well, I just try to use dropdown component instead of select component, and it works😂
So weird
So weird
link is for prefetching pages. if you are adding params use a server action.
@DirtyCajunRice | AppDir link is for prefetching pages. if you are adding params use a server action.
JWWOP
How can I adding params in url by server action?
@DirtyCajunRice | AppDir redirect()
JWWOP
Ok I’ll give it a try, thanks for your help