I defined a sizePerPageList with objects containing text and value keys. I get the following warning. Why?
Warning: Failed prop type: Invalid prop page of type object supplied to SizePerPageOption, expected number
@ipflowss I guess your value property is an object, it should be a number:
sizePerPageList: [{
text: '5', value: 5
}, {
text: '10', value: 10
}, {
text: 'All', value: products.length
}]
Please reopen this issue if the problem still remain, thank you
when products.length=0 show same message error: Failed prop type: Invalid prop page of type object supplied to SizePerPageOption, expected number.
This problem still exists in the react-bootstra-table-2
This is my code and I am still getting the same warning. tableData length is always more than zero.
var tableData =[]
if(this.props.data!=null){
tableData = this.props.data
}
sizePerPageList: [{
text: '5', value: 5
}, {
text: '10', value: 10
},
{
text: 'All', value: tableData.length
}]
getting following warning
Failed prop type: Invalid prop sizePerPage of type object supplied to PaginationList, expected number.
code like -
this.options = {
sizePerPage: 20,
sizePerPageList: [
{
text: '10', value: 10
},
{
text: '20', value: 20
},
{
text: '50', value: 50
},
{
text: 'All', value:0
}
]
};
this.options.sizePerPageList[3].value = (this.props.data)?this.props.data.length:0;
data will be type of Array always.
Most helpful comment
when products.length=0 show same message error: Failed prop type: Invalid prop
pageof typeobjectsupplied toSizePerPageOption, expectednumber.