-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got "onClick is deprecated, please use onPress" while no onClick
is used
#3196
Comments
The error was thrown from useLink.ts from react-specturm. onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {
pressProps.onClick?.(e);
if (deprecatedOnClick) {
deprecatedOnClick(e);
console.warn('onClick is deprecated, please use onPress');
} |
@chirokas the issue here is that |
@wingkwong, onClick is passed to Link in getButtonProps. |
We still allow users to pass onClick. However, if you look at the code, there is no |
Well, I'm willing to try. |
feel free to ping me in discord if you need help. |
The We need a private prop to represent the author's (non-user) |
Good finding. Apart from onClick: (e: React.MouseEvent<HTMLButtonElement>) => {
deprecatedOnClick?.(e);
},
I'm not sure what you mean. Mind to elaborate more? |
interestingly I didn't see that warning on my another branch. The difference is below. Maybe another direction to explore this issue. devDependencies:
- @react-types/shared 3.23.1
+ @react-types/shared 3.22.1 |
@chirokas You have not solved this issue for a long time, so I solved it. |
Discussed in #3193
Originally posted by bllakcn June 6, 2024
My first time using the
as
prop to render aLink
component as aButton
.I see this in my console
onClick is deprecated, please use onPress
from useLink.Is there anything I did wrong on my side?
The text was updated successfully, but these errors were encountered: