this.removeB = this.removeB.bind(this); // добавил bind
import React, {useState, useEffect } from "react";
export default function App() {
const [count, setCount] = useState(0);
const incCount = () => {
setCount(count+1);
};
useEffect(() => {
console.log(count);
});
return (
<div className="App">
<button onClick={() => { incCount(); }}>Inc count</button>
<div>{count}</div>
</div>
);
}
.done(function(html) {
$('#office-table').html(html);
// вот тут добавлять евенты
});