反应 JSX 无效的 ARIA 属性`ariaLabel`
React JSX Invalid ARIA attribute `ariaLabel`
反应 jsx:
<button ariaLabel='label'>click</button>
呈现 html:
<button arialabel="label">click</button>
控制台警告:
index.js:1 Warning: Invalid ARIA attribute `ariaLabel`. Did you mean `aria-label`?
嗯,不,我指的是 ariaLabel,因为我们总是在 jsx 中使用驼峰命名法。为什么渲染出来的都是小写的 html?
这似乎是一个例外。在此处查看文档 -- Official React Docs
Note that all aria-* HTML attributes are fully supported in JSX. Whereas most DOM properties and attributes in React are camelCased, these attributes should be hyphen-cased (also known as kebab-case, lisp-case, etc) as they are in plain HTML:
反应 jsx:
<button ariaLabel='label'>click</button>
呈现 html:
<button arialabel="label">click</button>
控制台警告:
index.js:1 Warning: Invalid ARIA attribute `ariaLabel`. Did you mean `aria-label`?
嗯,不,我指的是 ariaLabel,因为我们总是在 jsx 中使用驼峰命名法。为什么渲染出来的都是小写的 html?
这似乎是一个例外。在此处查看文档 -- Official React Docs
Note that all aria-* HTML attributes are fully supported in JSX. Whereas most DOM properties and attributes in React are camelCased, these attributes should be hyphen-cased (also known as kebab-case, lisp-case, etc) as they are in plain HTML: