import React, { Component } from 'react'; import PropTypes from 'prop-types'; import './checkbox.css'; export class Checkbox extends Component { static propTypes = { label: PropTypes.string.isRequired, checked: PropTypes.bool, }; constructor(props) { super(props); this.state = { checked: props.checked, label: props.label }; } handleChange(e) { this.setState({ checked: e.target.checked }); } render() { let checkbox; if (this.state.checked) { checkbox = ; } else { checkbox = ; } return (
); } }