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

253
Views
how to write hover in same class in css file for react js

enter image description here enter image description here

This is a reactjs project, Te amperzand syntax is working fine in Javascript file but not in css.

How to write hover class in css file?

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

You must write it this way

.baseStyle {
 /* base styles goes here*/

}

.baseStyle:hover {
/* hover styles goes here */
}

If you wish to attain what you intend you must use scss.

Then it will be like

.class {
    margin:20px;
    &:hover {
        color:yellow;
    }
}

Reference

  1. Using Scss in React
about 4 years ago · Santiago Gelvez Report

0

If you want to write in same class. You should use Sass/Scss.

Save the css file with .scss extension. It is a precprocessor for better syntax.

Refer this sandbox:

https://stackblitz.com/edit/react-uwktzj?file=src%2FApp.js

about 4 years ago · Santiago Gelvez 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!