Skip to content

useCss !important not possible #2644

@drsag-mgr

Description

@drsag-mgr

What is the current behavior?
Properties with !important will not be rendered in the generated css class, not even without the !important-flag.

The following Example:

const myComponent = ()=> {
  const styleClass = useCss({
    color: 'red !important',
    padding:5,
  })

  return <div class={styleClass}>TEST</div>
}

RENDERS:

<style>
.react-use-css-1x {
  padding:5px;
}
</style>

<div class="react-use-css-1x">TEST</TEST>

The color-Property is completely ignored and not part of the rendered css, not even without the !important.
Without the !important all functions well.

The expected Result is:

<style>
.react-use-css-1x {
  color: red !important;
  padding:5px;
}
</style>

<div class="react-use-css-1x">TEST</TEST>

A little about versions:

  • OS:
  • Browser (vendor and version):
  • React: 18.2.0
  • react-use: 17.6.0
  • Did this worked in the previous package version? NO

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