Closed
Description
React version: 18.0.0
Steps To Reproduce
- Render an
<img src="#" fetchPriority="high" />
tag
Link to code example: https://playcode.io/1011424
The current behavior
A warning is logged:
Warning: React does not recognize the `fetchPriority` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `fetchpriority` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
at img
at div
at App
The expected behavior
React should recognize the fetchPriority
prop and emit it as fetchpriority
into HTML.
To be clear, using <img fetchpriority="high">
works and doesn’t log a warning. However, it is inconsistent with other DOM APIs. In the JS DOM API, the attribute is camel-cased as HTMLImageElement.fetchPriority
.
fetchPriority
has been supported in Chromium browsers since Chromium 101 (Apr 26, 2022). Per Patrick Meenan, Mozilla is working on an implementation as well.