React switch component. Clone of Switchery rewritten for React.
npm install react-switchery-componentreact-switchery-component
=========================
React switch component.
Clone of Switchery rewritten for React.
npm install react-switchery-component
``javascript
import React from 'react';
import Switch from 'react-switchery-component';
import 'react-switchery-component/react-switchery-component.css';
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {isChecked: false};
}
handleChange(e) {
this.setState({isChecked: e.target.checked});
}
render() {
return (
onChange={(e) => this.handleChange(e)} />
checked={this.state.isChecked}
onChange={(e) => this.handleChange(e)} />
checked={this.state.isChecked}
onChange={(e) => this.handleChange(e)} />
checked={this.state.isChecked}
onChange={(e) => this.handleChange(e)} />
checked={this.state.isChecked}
onChange={(e) => this.handleChange(e)} />