Short answer: use classSet(): http://facebook.github.io/react/docs/class-name-manipulation.html
Longer answer:
It's not much different in React, besides you write a plain old JavaScript, so lots of control here. Also, React already has a nifty addon to make it even easier. In this case your component will look something like this:
var ClassnameExample = React.createClass({
render: function() {
var cx = React.addons.classSet;
var classes = cx({
"message": true,
"warning": this.props.warningLevel === "3",
"critical": this.props.warningLevel === "5"
});
return <p className={classes}>Test</p>;
}
});
Here is the working example: http://jsbin.com/lekinokecoge/1/edit?html,css,js,output
Just try to change the value here:
React.renderComponent(<ClassnameExample warningLevel="3" />, document.body);