Button Link #3778
Button Link
#3778
-
|
Beta Was this translation helpful? Give feedback.
Answered by
reidbarber
Nov 22, 2022
Replies: 1 comment
-
The Button component does not support this. We've had this issue come up internally before and here is the general takeaway:
React Router 6.x.x: const navigate = useNavigate();
...
<Button onPress={() => navigate("/newpage")}>
Click here
</Button> React Router 5.x.x: const history = useHistory();
...
<Button onPress={() => history.push("/newpage")}>
Click here
</Button>
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
snowystinger
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Button component does not support this. We've had this issue come up internally before and here is the general takeaway:
In general, links should look like links instead of buttons.
There is a workaround where you can navigate within the Button's onPress handler:
React Router 6.x.x:
React Router 5.x.x: