classname react multiple code example

Example 1: jsx classname multiple

// Using String Templates
<div className={`${this.state.className} ${this.props.content.divClassName}}`>
	...
</div>
// OR
// Using An Array
<div className={[this.state.className, this.props.content.divClassName].join(" ")}>
	...
</div>

Example 2: add 2 class names react

<input className={`form-control round-lg ${this.state.valid ? '' : 'error'}`} />

Example 3: react multiple classnames

className={[this.state.className, this.props.content.divClassName].join(" ")}

Example 4: How to add multiple classes to a ReactJS Component

var liClasses = classNames({
      'main-class': true,
      'activeClass': self.state.focused === index
    });

    return (<li className={liClasses}>{data.name}</li>);