-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fix React warning with data attributes #1841
Conversation
Your Render PR Server URL is https://storage-ui-stage-pr-1841.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-c7atl6jvog4ifk3n7jgg. |
Your Render PR Server URL is https://chainsafe-components-stage-pr-1841.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-c7atl73vog4ifk3n7jt0. |
Your Render PR Server URL is https://files-ui-stage-pr-1841.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-c7atl7jvog4ifk3n7k1g. |
@@ -356,7 +356,7 @@ const Button: React.FC<IButtonProps> = ({ | |||
)} | |||
disabled={disabled || loading} | |||
{...rest} | |||
data-testId={`button-${testId}`} | |||
data-testid={`button-${testId}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all the ${testId}
references be updated too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no I think it's ok because that's a prop in a component that doesn't end up as an html attribute. The problem from the warning is that the prop was directly translated as html, and html attributes should not have camelCase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok! Thanks for the explanation :)
Something I missed, thanks @tanmoyAtb: React doesn't like having camelCase for data attributes somehow.
So we'll have to live with
data-testid
all lower case, still more consistent than before.