Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React warning when there's only one page to show in v3.5.0 #1518

Closed
alejo90 opened this issue Jul 30, 2017 · 3 comments
Closed

React warning when there's only one page to show in v3.5.0 #1518

alejo90 opened this issue Jul 30, 2017 · 3 comments

Comments

@alejo90
Copy link

alejo90 commented Jul 30, 2017

I upgraded to 3.5.0 and now a React warning stating Each child in an array or iterator should have a unique "key" prop. Check the render method of PaginationList` now appears when there's only one page to show. I traced the problem to here (https://github.com/AllenFang/react-bootstrap-table/blob/master/src/pagination/PaginationList.js#L123):

return (
  <div className='row' style={ { marginTop: 15 } }>
    {
      content ||
        [ (
          <div className='col-md-6 col-xs-6 col-sm-6 col-lg-6'>
            { total }{ sizePerPageList.length > 1 ? dropdown : null }
          </div>
          ), (
          <div style={ { display: hidePageList } }
            className='col-md-6 col-xs-6 col-sm-6 col-lg-6'>
            { pageBtns }
          </div>
        ) ]
    }
  </div>
);

When content is undefined, the div elements in the array are rendered. Since it's an array, each div element has to have a key.

@alejo90 alejo90 changed the title React warning when there's only one page to show React warning when there's only one page to show in v3.5.0 Jul 30, 2017
@jyrihogman
Copy link

Same error here on 3.5.0, but I get that error even with multiple pages.

@AllenFang
Copy link
Owner

I'll fix it ASAP,, thanks

@AllenFang
Copy link
Owner

Fixed on v3.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants