react-table v7.0.0-rc.7 Release Notes

Release Date: 2019-12-10 // over 4 years ago
  • โœ‚ Removed:

    • ๐Ÿ—„ applyHooks (exported but undocumented) function has been deprecated. Please use either reduceHooks or loopHooks utilities in your custom plugins now.
    • ๐Ÿ—„ applyPropHooks (exported but undocumented) function has been deprecated. Please use the makePropGetter utility in your custom plugins now.

    โž• Added:

    • reduceHooks exported utility which is used to reduce a value through a collection of hooks. Each hook must return a value (mutation is discouraged)
    • loopHooks exported utility which is used to loop over a collection of hooks. Hooks are not allowed to return a value (mutation is encouraged)
    • makePropGetter exported utility which is used to create prop getters from a prop getter hook.
    • ๐Ÿ”Œ useOptions plugin hook, which allows a plugin to reduce/modify the initial options being passed to the table
    • ๐Ÿ”Œ useFinalInstance plugin hook, which allows a plugin access to the final table instance before it is returned to the user.

    Modified:

    • ๐Ÿ’… Prop-getter hook functions now support returning an array (in addition to the typical object of props). When an array is returned, each item in the array is smart-merged into a new props object (meaning it will intelligently compose and override styles and className)
    • Prop-getter function supplied to the table have 2 new overloaded options (in addition to the typical object of props):
      • Function(props, instance, ...row/col/context) => Array<props> | props - If a function is passed to a prop getter function, it will receive the previous props, the table instance, and potentially more context arguments. It is then be expected to return either an array of new props (to be smart-merged with styles and classes, the latest values taking priority over the previous values) or a props object (which will replace all previous props)
      • Array<props> - If an array is passed to a prop getter function, each prop object in the array will be smart-merged with styles and classes into the props from previous hooks (with the latest values taking priority over the previous values).
    • 0๏ธโƒฃ Extracted default hooks into separate file.
    • โœ… Converted almost all usages of instanceRef.current to use useGetLatest(instanceRef.current) to help with avoiding memory leaks and to be more terse.
    • Converted all previous prop-getter definitions to use the new makePropGetter
    • ๐Ÿ”Œ Reorganized plugin hooks to declare as many hooks in the main plugin function as opposed to in the useInstance hook.
    • ๐Ÿ”„ Changed the useInstanceBeforeDimensions hook to be a loopHooks call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance)
    • ๐Ÿ”„ Changed the useInstance hook to be a loopHooks call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the instance)
    • ๐Ÿ”„ Change the prepareRow hook to be a loopHooks call instead of a reducer. An error will be thrown now if any of these hook functions returns a value (to encourage mutation of the row)