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 eitherreduceHooks
orloopHooks
utilities in your custom plugins now. - ๐
applyPropHooks
(exported but undocumented) function has been deprecated. Please use themakePropGetter
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 useuseGetLatest(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 aloopHooks
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 aloopHooks
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 aloopHooks
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)
- ๐