onClick show walk in record BOOKING ID

onClick={() => show("walk_in", record?.BOOKING_ID)} onClick={() => { go({ to: getToPath({ resource: "walk_in" action: "show", meta: { id: 1, }, }), }); }} Hi, When I use useGo it doesn't navigate to the page.
12 Replies
kapa.ai
kapa.ai15mo ago
Hi @Batu. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
like-gold
like-gold15mo ago
resource: "walk_in" make sure you are passing resource correctly here, as you passed to <Refine > component in your entrypoint file. resource names are usually plural.
kapa.ai
kapa.ai15mo ago
Sorry @Batu, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist: Perhaps try again in 15mins?
metropolitan-bronze
metropolitan-bronze15mo ago
onClick={() => show("walk_in", record?.BOOKING_ID)} I use show and it still works. { name: "walk_in", list: "/frontdesk/walk_in", show: "/frontdesk/walk_in/show/:id", meta: { label: "Walk in", parent: "frontdesk", }, }, <Route path="/frontdesk/walk_in"> <Route index element={<WalkInList />} /> <Route path="show/:id" element={<WalkInList />} /> </Route> Do you consider this correct?
like-gold
like-gold15mo ago
Can you create a reproducible example on stackblitz? We can help you better if you provide us.
metropolitan-bronze
metropolitan-bronze15mo ago
I will try to create an example on stackblitz, you can preview the error with useGo. onClick={() => show("walk_in", record?.BOOKING_ID)} onClick={() => { go({ to: getToPath({ resource: "walk_in" action: "show", meta: { id: 1, }, }), }); }} hooks {show} = useNavigation() => it still active hooks go = useGo() => it inactive @Batu Can you help me with this problem? When clicking the button, view details of a row in the table, and navigate to another page. And I want to have the data of that row. So how can it be used?
like-gold
like-gold15mo ago
Can you try to use like this?
import { useGo } from "@refinedev/core"

const go = useGo()

....


go({to: { resource: "walk_in", action: "show", id: 1 }})
import { useGo } from "@refinedev/core"

const go = useGo()

....


go({to: { resource: "walk_in", action: "show", id: 1 }})
You can check the docs here: https://refine.dev/docs/api-reference/core/hooks/navigation/useGo/#with-resource
useGo | refine
useGo is a hook that leverages the go method of the routerProvider to perform navigation operations.
metropolitan-bronze
metropolitan-bronze15mo ago
Yepp, I have to pass data to other component while using useGo. And I don't want to use query parameter
like-gold
like-gold15mo ago
How do you plan to pass data to another component without query parameters? This is not a refine question.
metropolitan-bronze
metropolitan-bronze15mo ago
https://discord.com/channels/837692625737613362/1159227638821433495/1159228328805412945 same as the question here. So we have to use React Context, right?
like-gold
like-gold15mo ago
Yeah
metropolitan-bronze
metropolitan-bronze15mo ago
thanks you

Did you find this page helpful?