Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
¿Por qué mis clases CSS no funcionan en mi proyecto React?

Para esta parte, estoy tratando de cambiar el color del texto según el índice de caracteres, pero el estilo simplemente no funciona.

 import "../stylesheets/TypingTest.css" const TypingTest = (props) => { return ( <div> <div> {props.words.split("").map(function (char, idx) { return ( <span className={props.index === idx ? "right" : "wrong"}> {char} </span> ); })} <div>{props.index}</div> </div> </div> ); }; export default TypingTest;
 .right{ color: var(red); } .wrong{ color: var(green); }

También para tener en cuenta, si elimino la lógica para que se convierta en className='right' , todavía no funciona

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Porque tu css está mal:

 .right { color: var(red); <--- you are try to use a css variable. } .wrong { color: var(green); <--- you are try to use a css variable. }

Si quieres usar variables CSS que puedes definir:

 --red: red; --green: green: .right { color: var(--red); } .wrong { color: var(--green); }
about 4 years ago · Juan Pablo Isaza Report

0

¿No debería ser

var(--red)

Y

var(--green)

https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!