How to use the react-table.propTypes function in react-table

To help you get started, we’ve selected a few react-table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glin / reactable / srcjs / Reactable.js View on Github external
)
  }
})

// By default, the loading text is always present and read by screen readers, even
// when hidden. Hide the loading text completely to prevent it from being read.
const DefaultLoadingComponent = ReactTableDefaults.LoadingComponent
Object.assign(ReactTableDefaults, {
  LoadingComponent({ loading, ...rest }) {
    return loading ? DefaultLoadingComponent({ loading, ...rest }) : null
  }
})

ReactTable.propTypes = fixedReactTablePropTypes

// Prevent unnecessary data updates on table rerenders by doing a deep comparison
// of data props rather than a === comparison. Kind of ugly, but significantly
// increases performance when selecting or expanding rows in a very large table.
ReactTable.prototype.oldComponentWillReceiveProps = ReactTable.prototype.componentWillReceiveProps
ReactTable.prototype.componentWillReceiveProps = function(newProps, newState) {
  newProps = { ...newProps }
  if (this.props.dataKey && this.props.dataKey === newProps.dataKey) {
    newProps.data = this.props.data
    newProps.columns = this.props.columns
  }
  const dataUpdateProps = ['pivotBy', 'sorted', 'filtered']
  dataUpdateProps.forEach(name => {
    if (JSON.stringify(this.props[name]) === JSON.stringify(newProps[name])) {
      newProps[name] = this.props[name]
    }