question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-bootstrap-table2-paginator not working.

See original GitHub issue

Hello,

I get the below error when I try to add pagination functionality to the bootstrap table. Here’s what I have -

import * as React from 'react';
import { Component } from 'react';
import BootstrapTable from "react-bootstrap-table-next";
import paginationFactory from 'react-bootstrap-table2-paginator';

export class Queues extends Component<{}, IQueueState> {
	constructor() {
		super({});
		this.state = {
			queues: [{
					"id": "1",
					"name": "Book",
					"price": "18"
				},
				{
					"id": "2",
					"name": "Mobile",
					"price": "400"
				}], loading: true
		};
	}

	public render() {
		const columns = [
			{
				dataField: 'id',
				text: 'Product ID'
			},
			{
				dataField: 'name',
				text: 'Product Name'
			}, {
				dataField: 'price',
				text: 'Product Price'
			}
		];
		return <div>
			       <h2>With Pagination </h2>
			       
                               <BootstrapTable keyField='id'
			                       data={this.state.queues}
			                       columns={columns}
			                       pagination={paginationFactory()} />

		       </div>;
	}

And the dependencies that I have currently -

		"react": "^16.4.1",
		"react-bootstrap-table-next": "^0.1.12",
		"react-bootstrap-table2-paginator": "^0.1.4",
		"react-dom": "^16.4.1"

Without pagination property the table renders properly but I get the below error when I add paginator -

Uncaught Error: n.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.
    at e.exports (vendor.js?v=gWN0dwqp0_yY627VZPL5GJPbGaLm6i9oU_upMHr2BP4:1)
    at l._renderValidatedComponent (vendor.js?v=gWN0dwqp0_yY627VZPL5GJPbGaLm6i9oU_upMHr2BP4:58)
    at l.performInitialMount (vendor.js?v=gWN0dwqp0_yY627VZPL5GJPbGaLm6i9oU_upMHr2BP4:58)

Any help here is much appreciated!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Genaritocommented, Jul 19, 2018

I had the same issue, I installed React and React-Dom in their 16.4.1 version and updated dependencies and all worked:

npm i react@16.4.1 --save
npm i react-dom@16.4.1 --save
npm update
0reactions
Manishku99251commented, Nov 22, 2018

@Genarito updating dependencies worked like a charm Thanks for the fix appreciate it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pagination not working in react-bootstrap-table2
I am using react-bootstrap-table2-paginator for adding Pagination to my BootstrapTable. I get the below error when I add the Pagination part ...
Read more >
react-bootstrap-table2-paginator - npm
Start using react-bootstrap-table2-paginator in your project by running `npm i react-bootstrap-table2-paginator`.
Read more >
react-bootstrap-table2-paginator examples - CodeSandbox
Learn how to use react-bootstrap-table2-paginator by viewing and forking example apps that make use of react-bootstrap-table2-paginator on CodeSandbox. ...
Read more >
Remote Table · react-bootstrap-table2 - GitHub Pages
In the remote pagination, react-bootstrap-table2 doesn't know all the data, only have the data on current page. So that's why you need to...
Read more >
Setup React Table Pagination | React Bootstrap Table2
Setup React Table Pagination | React BootstrapWhats up y'all in this video I will teach y'all how to how setup pagination for your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found