В моем MuiTable у меня есть:
<MuiTable
padding="dense"
data={pageData}
pagination={{
count: data ? data.length : 0,
rowsPerPage: count,
page: page - 1,
rowsPerPageOptions: [10, 25, 100, 500],
onChangePage: this.handlePageChange,
onChangeRowsPerPage: this.handleCountChange,
}}
и
const mapStateToProps = (state , props) => {
const search: any = deparamSearch(props.location.search);
return {
orders: (state.orders.list || []),
page: Number.parseInt(search.page || 1),
count: search.count || 10,
};
};
const mapDispatchToProps = (dispatch) => ({
fetchOrders: (values, search?) => dispatch(fetchOrders(values, search)),
});
, и я получаю предупреждение:
Warning: Failed prop type: Invalid prop `rowsPerPage` of type `string` supplied to `TablePaginationActions`, expected `number`
похоже, что count является строкой, а яЯ делаю эти вычисления без ошибок:
const data = orders;
const start = count * (page - 1);
const pageData = data && data.slice(start, start + count);
и в моем бэкэнд-файле:
public abstract Optional<Integer> count();
public abstract Optional<Integer> page();
Я не могу понять, почему count
является строкой.