chenglou/RCSS

Don't mutate style object passed onto `createClass`

Closed this issue · 1 comments

Currently a className field is added. We shouldn't do that. Except the current API relies on it.
This makes inserting style inline hard. Here's a tentative new API:
createClass(styleObj) returns a new object of the following format:

{
  className: 'bla',
  style: styleObjReferenceWithNoMutation
}

This way, if you decide to do inline style (in React), you can: <div style={styleObj.style} />. It gets trickier with pseudo-selectors though. Good thing I haven't pushed the pseudo-selectors release yet.

Yeah - I had it return the className but didn't want to break the current API