From 1d0c6f5b34f6af822d746768b7310fa8ecadc0bd Mon Sep 17 00:00:00 2001 From: Tanner Linsley Date: Tue, 5 Nov 2019 14:10:55 -0700 Subject: [PATCH] Update api.md --- docs/api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/api.md b/docs/api.md index dab9dbd..6a753a3 100644 --- a/docs/api.md +++ b/docs/api.md @@ -93,6 +93,7 @@ The following options are supported via the main options object passed to `useTa - When either the internal `state` or this `state` object change, this object is **always merged over the internal table state** (eg. `{...state, ...overrides}`) to produce the final state object that is then passed to the `useTable` options. - `reducer: Function(oldState, newState) => finalState` - Optional + - Must be **memoized** - Inspired by Kent C. Dodd's [State Reducer Pattern](https://kentcdodds.com/blog/the-state-reducer-pattern-with-react-hooks) - With every `setState` call to the table's internal `React.useState` instance, this reducer is called and is allowed to modify the final state object for updating. - It is passed the `oldState`, the `newState`, and when provided, an optional action `type`.