-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
classnames is a simpler way to interact with class names in React.
Allows for using an array or dict to defined classes, can make code a lot cleaner.
/* components/submit-button.js */
import { Component } from 'react';
import classNames from 'classnames/bind';
import styles from './submit-button.css';
let cx = classNames.bind(styles);
export default class SubmitButton extends Component {
render () {
let text = this.props.store.submissionInProgress ? 'Processing...' : 'Submit';
let className = cx({
base: true,
inProgress: this.props.store.submissionInProgress,
error: this.props.store.errorOccurred,
disabled: this.props.form.valid,
});
return <button className={className}>{text}</button>;
}
};
Metadata
Metadata
Assignees
Labels
No labels