YoyoO
YoyoO

Reputation: 71

How do you get rid of the console warning “Undefined” when using the React Data Grid

I'm using React Data Grid(https://adazzle.github.io/react-data-grid/) a few times in my app. I've noticed that there is a console warning for a prop "Undefined", that prints even when only using the minimum required props.

minimal, reproducible example
Install RDG
$ npm install react-data-grid --save
or with yarn:
$ yarn add react-data-grid

file.tsx

import React from 'react';
import ReactDataGrid from 'react-data-grid';

const columns = [
  { key: 'id', name: 'ID' },
  { key: 'title', name: 'Title' },
  { key: 'count', name: 'Count' } ];

const rows = [{id: 0, title: 'row1', count: 20}, {id: 1, title: 'row1', count: 40}, {id: 2, title: 'row1', count: 60}];

function HelloWorld() {
  return (
    <ReactDataGrid
      columns={columns}
      rowGetter={i => rows[i]}
      rowsCount={3}
    />
  );
}

That's actually snippet from: https://adazzle.github.io/react-data-grid/docs/examples/simple-grid You can check your console warnings @ that linked page as well.

I expect that when I'm using the base grid as described in the docs, that there will be no errors/warnings.

     ?                                0     1     1
 ><({,''>                         <'',}})><   1   0          
                                   0   1  0       

Upvotes: 1

Views: 449

Answers (1)

YoyoO
YoyoO

Reputation: 71

Workaround: Set rowScrollTimeout to null

<ReactDataGrid
  columns={this.state.columns}
  rowGetter={this.rowGetter}
  rowsCount={this.getSize()}

  rowScrollTimeout={null}

  />

Thank you Matthew Owen :
@ https://github.com/adazzle/react-data-grid/issues/1403#issuecomment-499631101

Upvotes: 1

Related Questions