1
votes

React seems to be removing the css class I want to set on the div returned from render. It even happens if I nest another div inside the first, and set the class on the enclosed div.

var NightComponent = React.createClass({ render: function() { return test ; } });

How do I do this in react?

1

1 Answers

0
votes

class is not used to designate classes in React. You need to use className, as noted in the React docs.

Note: Since JSX is JavaScript, identifiers such as class and for are discouraged as XML attribute names. Instead, React DOM components expect DOM property names like className and htmlFor, respectively.