document.getElementById("AAA").onmousedown = (e) => this.mouse_down(e);
document.onmousemove = () => this.manipulate_this_element();
class App extends React.Component {
constructor(props) {
super(props);
this.justAdd = this.justAdd.bind(this);
}
justAdd() {
// your logic
}
}
class App extends React.Component {
// option 2
justAdd = () => {
// your logic,
};
}
class App extends React.Component {
state = {
music: musicButton,
}
onClick = e => {
if (this.audio) {
this.audio.pause();
}
this.audio = new Audio(e.target.dataset.url);
this.audio.play();
}
render() {
return (
<div>
{this.state.music.map(n => (
<button onClick={this.onClick} data-url={n.url} key={n.numButton}>{n.soundsName}</button>
))}
</div>
);
}
}