ReactJS: Flickering checkbox

This entry is part 13 of 35 in the series React JS

https://codepen.io/gaearon/pen/PJKEGp

class FlickeringCheckbox extends React.Component {
  constructor(){
    super();
    this.state = { isIndeterminate: true };
  }
  componentDidMount() {
    setInterval(() => this.setState({isIndeterminate: !this.state.isIndeterminate}), 500);
  }
  render() {
    return <input 
      type="checkbox"
      ref={elem => elem && (elem.indeterminate = this.state.isIndeterminate)}
    />

  }
}

ReactDOM.render(
  <FlickeringCheckbox />,
  document.getElementById('root')
);