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

264
Views
Why isn't there a "class" prop for React?

In React.DOM.Props from purescript-react, DOM node attributes are nearly exhaustively listed there, except for a class attribute (I'd suspect it to be named _class, similar to _type for Purescript's syntax issue). I tried to make my own with

_class :: String -> Props
_class = unsafeMkProps "class"

And attempted to use it, but after inspecting the HTML, React didn't include the attribute! Why is this? Why can't I use a class attribute in my DOM nodes?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You probably want to use className here and not class. This is done to prevent confusion between a JavaScript class and the DOM attribute class.

Here's what the official documentation says:

To specify a CSS class, use the className attribute. This applies to all regular DOM and SVG elements like <div>, <a>, and others.

It is actually even listed in the page you're linking to, here

className :: String -> Props
over 4 years ago · Santiago Trujillo 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!