ReqoreLink forwards the isText styling prop to a custom 'as' element (React warning with react-router's Link)

Aperta
#707 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

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

Direzione di ricerca

Start with ReqoreLink and trace how its isText styling prop is forwarded when a custom as element is used; the issue does not name the implementation or test files. Check the existing tests for custom as elements and run them before making a change. Done means styled-only props such as isText no longer reach the custom element or its DOM output, and the React warning is covered by a regression test.

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

Descrizione

What happens

ReqoreLink with a custom element, e.g. react-router's link:

<ReqoreLink as={Link} to="/blog/some-post" underline={false}>Title</ReqoreLink>

passes Reqore's internal isText styling prop through to the custom element. react-router's Link spreads unknown props onto its <a>, so React warns on every render:

Warning: React does not recognize the `isText` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `istext` instead.

Seen with @qoretechnologies/reqore 0.77.5 (beta), React 18, react-router-dom 6.

What the landing page needs

The qorus.cloud post cards (src/components/blog/PostCard.tsx in qorus-saas-landing) make the card's title a router link with ReqoreLink as={Link}, as the prop's docs suggest. isText (and any other styled-only prop) should be filtered with shouldForwardProp / a transient $ prop before it reaches a custom as element.

Meanwhile

The landing page wraps react-router's Link in a small adapter that drops isText, marked TODO(reqore) with this issue; it goes away once Reqore filters the prop.

Lingua principale
TypeScript
Stelle
4
Fork
0
Merge medio
16h 28m
PR unite (30g)
9

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 qoretechnologies/reqore

Tutte le issue di qoretechnologies/reqore

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.