how to build a custom pagination component in react