-
In react.js we can have dash-case attributes in components using aliases. I can see const Link = ({
to,
className,
onClick,
target,
rel,
key,
'aria-label': ariaLabel,
}) => {
}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Props are just a struct, so each prop is a struct field name. Rust identifiers can't have dashes (as far as I know) so struct field names/prop names can't have dashes. I guess in theory it's possible to modify the view macro so that it rewrites any dash-cased prop names to snake_case but it just seems like an extra layer of confusion to me. |
Beta Was this translation helpful? Give feedback.
Props are just a struct, so each prop is a struct field name. Rust identifiers can't have dashes (as far as I know) so struct field names/prop names can't have dashes.
I guess in theory it's possible to modify the view macro so that it rewrites any dash-cased prop names to snake_case but it just seems like an extra layer of confusion to me.