You can create an element with multiple class names like this, I tryed these both way, its working fine...
If you importing any css then you can follow this way : Way 1:
import React, { Component, PropTypes } from 'react';
import csjs from 'csjs';
import styles from './styles';
import insertCss from 'insert-css';
import classNames from 'classnames';
insertCss(csjs.getCss(styles));
export default class Foo extends Component {
render() {
return (
<div className={[styles.class1, styles.class2].join(' ')}>
{ 'text' }
</div>
);
}
}
way 2:
import React, { Component, PropTypes } from 'react';
import csjs from 'csjs';
import styles from './styles';
import insertCss from 'insert-css';
import classNames from 'classnames';
insertCss(csjs.getCss(styles));
export default class Foo extends Component {
render() {
return (
<div className={styles.class1 + ' ' + styles.class2}>
{ 'text' }
</div>
);
}
}
**
If you applying css as internal :
const myStyle = {_x000D_
color: "#fff"_x000D_
};_x000D_
_x000D_
// React Element using Jsx_x000D_
const myReactElement = (_x000D_
<h1 style={myStyle} className="myClassName myClassName1">_x000D_
Hello World!_x000D_
</h1>_x000D_
);_x000D_
_x000D_
ReactDOM.render(myReactElement, document.getElementById("app"));
_x000D_
.myClassName {_x000D_
background-color: #333;_x000D_
padding: 10px;_x000D_
}_x000D_
.myClassName1{_x000D_
border: 2px solid #000;_x000D_
}
_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.4.0/umd/react.production.min.js"></script>_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.4.0/umd/react-dom.production.min.js"></script>_x000D_
<div id="app">_x000D_
_x000D_
</div>
_x000D_