Getting rest id [...rest].js file from link like VehicleDetails/4 #562
Answered
by
britisharmy
britisharmy
asked this question in
Q&A
-
I have a link when clicked takes a user to a specific page. In that page i would like to display specific data from the passed ID. My link looks like How can i get the id 4 I am using segments
My code returns null. but i cant get the rest id for instance in |
Beta Was this translation helpful? Give feedback.
Answered by
britisharmy
May 12, 2023
Replies: 1 comment
-
I used pathname and it worked
then
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
britisharmy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used pathname and it worked
onPress={() => { router.push({ pathname: 'VehicleDetails/[id]', params: { id: 4} }); }}
then
import { usePathname } from "expo-router";