React dose not allow CSS properties to appear in props

0
closed
unix
unix
Posted 4 months ago

React dose not allow CSS properties to appear in props #666

Bug report 🐞

Version & Environment

Expected Behaviour

We added the scale function in v2.2.0, which extends some generic props, however, the CSS properties in it cannot be used as the props of the component.

e.g.

// not allow
<Button marginRIght="10px" />

// good
<Button mr="10px" />

Actual results (or Errors)

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

Solutions

We need to remove the scale-related properties before passing them to the real DOM.