Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

useCss !important not possible

Aperta
#2,644 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
css, react, typescript
Ambito
frontend

Direzione di ricerca

Start by locating the useCss hook and reproduce the reported example with color: 'red !important' alongside padding: 5. Confirm that the generated CSS includes both declarations, with the color value retaining !important, and verify that ordinary declarations still render correctly.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
TypeScript
Stelle
44k
Fork
3.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di streamich/react-use

Tutte le issue di streamich/react-use

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.