const TableContainer = ({books, fetchSpeed}) => {
useEffect(() => { fetchSpeed() }, [books]);
return (
<div className="table" id="speed">
<div className="table-container">
<Table className="table" size="small" aria-label="a dense table">
<TableHead>
<TableRow>
<TableCell>Dessert (100g serving)</TableCell>
<TableCell align="right">Calories</TableCell>
<TableCell align="right">Fat (g)</TableCell>
<TableCell align="right">Carbs (g)</TableCell>
<TableCell align="right">Protein (g)</TableCell>
</TableRow>
</TableHead>
<TableBody>
</TableBody>
</Table>
</div>
</div>
)
}
const mapDispatchToProps = (dispatch, { speedService }) => {
return {
fetchSpeed: fetchSpeed(speedService, dispatch)
};
};
const mapStateToProps = ({ books, loading, error }) => {
return { books, loading, error };
}
export default compose(withSpeedService(),connect(mapStateToProps, mapDispatchToProps))(TableContainer);
Объясните плиз, почему оно бесконтрольно обновляется?