Skip to content

Using attribute aspectRatio inside react Image causes react warning #862

Description

@paulrogov

Describe the bug
Using attribute aspectRatio inside React import { Image } from "@unpic/react"; causes React Warning:
I use vite bundler.

Packages:

"react": "^18",
"react-dom": "^18",
"vite": "^8.0.0",
"@unpic/react": "^1.0.2",

React Warning message:

Warning: React does not recognize the `%s` prop on a DOM element. 
If you intentionally want it to appear in the DOM as a custom attribute, 
spell it as lowercase `%s` instead. If you accidentally passed it from a parent 
component, remove it from the DOM element.%s aspectRatio aspectratio

To Reproduce
Steps to reproduce the behavior:

  1. Write a React component
import { Image } from "@unpic/react";

export default function Component() {

  <Image src={src} alt="alt" height={40} aspectRatio={3.76} />
}
  1. Launch npm run dev

Expected behavior
No warnings.

Desktop (please complete the following information):

  • OS: Ubuntu 24.04
  • Browser: Chrome
  • Version: 144

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions