diff --git a/src/hooks/useRows.js b/src/hooks/useRows.js index b7b5c5e..aa32f5d 100755 --- a/src/hooks/useRows.js +++ b/src/hooks/useRows.js @@ -1,4 +1,4 @@ -import { useMemo } from 'react' +import React from 'react' import PropTypes from 'prop-types' const propTypes = { @@ -10,7 +10,7 @@ export const useRows = props => { const { debug, columns, subRowsKey = 'subRows', data } = props - const accessedRows = useMemo(() => { + const accessedRows = React.useMemo(() => { if (debug) console.info('getAccessedRows') // Access the row's data diff --git a/src/hooks/useTable.js b/src/hooks/useTable.js index 4d9c1c5..0bd5f9e 100755 --- a/src/hooks/useTable.js +++ b/src/hooks/useTable.js @@ -21,7 +21,7 @@ export const useTable = (props, ...plugins) => { // Destructure props let { - data = [], + data, state: userState, useColumns: userUseColumns = useColumns, useRows: userUseRows = useRows, @@ -44,10 +44,9 @@ export const useTable = (props, ...plugins) => { headerGroups: [], rows: [], row: [], - renderableRows: [], getTableProps: [], getRowProps: [], - getHeaderRowProps: [], + getHeaderGroupProps: [], getHeaderProps: [], getCellProps: [], } @@ -87,7 +86,7 @@ export const useTable = (props, ...plugins) => { column.render = (type, userProps = {}) => { const Comp = typeof type === 'string' ? column[type] : type - if (!Comp) { + if (typeof Comp === 'undefined') { throw new Error(renderErr) } @@ -134,12 +133,12 @@ export const useTable = (props, ...plugins) => { // Give headerGroups getRowProps if (headerGroup.headers.length) { - headerGroup.getRowProps = (props = {}) => + headerGroup.getHeaderGroupProps = (props = {}) => mergeProps( { key: [`header${i}`].join('_'), }, - applyPropHooks(api.hooks.getHeaderRowProps, headerGroup, api), + applyPropHooks(api.hooks.getHeaderGroupProps, headerGroup, api), props ) return true @@ -195,7 +194,7 @@ export const useTable = (props, ...plugins) => { cell.render = (type, userProps = {}) => { const Comp = typeof type === 'string' ? column[type] : type - if (!Comp) { + if (typeof Comp === 'undefined') { throw new Error(renderErr) }