Open
Description
Hi,
I wanna make pagination, but i can't make it. Maybe someone knows how to make it. Can you help me please. My dashboard component codes are as below.
import React, { Component } from 'react';
import ProductListTable from '../products/ProductListTable';
import { connect } from 'react-redux';
import { firestoreConnect } from 'react-redux-firebase';
import { compose } from 'redux';
import { Link, Redirect } from 'react-router-dom';
class Dashboard extends Component {
render() {
const { products, auth } = this.props;
if(!auth.uid) return <Redirect to='/admin/login' />
return (
<div className="admin-dashboard">
<div className="container">
<h3 className="mt-5 mb-5 text-dark text-center">Product List</h3>
<div className="row">
<div className="col-12 mb-2">
<button className="btn btn-primary btn-sm mr-2" disabled>Delete All</button>
<Link to="/admin/product/create" className="btn btn-primary btn-sm">Add Product</Link>
</div>
</div>
<ProductListTable products={products} />
</div>
</div>
)
}
}
const mapStateToProps = (state) ={
return {
products: state.firestore.ordered.products,
auth: state.firebase.auth,
}
}
export default compose(
firestoreConnect([
{
collection: 'products',
orderBy : ['createdAt','desc']
}
]),connect(mapStateToProps)
)(Dashboard);