diff --git a/README.md b/README.md index e1224b0..8da9b43 100644 --- a/README.md +++ b/README.md @@ -28,26 +28,23 @@ import ReactDOM from 'react-dom'; import Wavesurfer from 'react-wavesurfer'; class MyComponent extends React.Component { - constructor(props) { - super(props); - - this.state = { - playing: false, - pos: 0 - }; - this.handleTogglePlay = this.handleTogglePlay.bind(this); - this.handlePosChange = this.handlePosChange.bind(this); + state = { + playing: false, + pos: 0 } - handleTogglePlay() { - this.setState({ - playing: !this.state.playing - }); + + handleTogglePlay = () => { + this.setState(prevState => ({ + playing: !prevState.playing + })); } - handlePosChange(e) { + + handlePosChange = (e) => { this.setState({ pos: e.originalArgs[0] }); } + render() { return (