From a9a93685eb569e27916c50632c25b8ce6e2cf2c1 Mon Sep 17 00:00:00 2001 From: artem Date: Wed, 22 Jan 2020 18:30:18 +0300 Subject: [PATCH] Removed from the example useMemo, propTypes, also simplified the example. --- docs/List.md | 77 +++++++++++++++++++--------------------------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/docs/List.md b/docs/List.md index 80a3687c60c..b8c03e402cd 100644 --- a/docs/List.md +++ b/docs/List.md @@ -99,10 +99,10 @@ const ListActions = ({ resource, filters, displayedFilters, - exporter, + exporter, // you can hide ExportButton if exporter = (null || false) filterValues, permanentFilter, - hasCreate, + hasCreate, // you can hide CreateButton if hasCreate = false basePath, selectedIds, onUnselectItems, @@ -110,55 +110,34 @@ const ListActions = ({ maxResults, total, ...rest -}) => useMemo( - () => ( - - {filters && cloneElement(filters, { - resource, - showFilter, - displayedFilters, - filterValues, - context: 'button', - })} - {hasCreate && } - {exporter !== false && ( - - )} - {/* Add your custom actions */} - - - ), - [resource, displayedFilters, filterValues, selectedIds, filters, total], +}) => ( + + {filters && cloneElement(filters, { + resource, + showFilter, + displayedFilters, + filterValues, + context: 'button', + })} + + + {/* Add your custom actions */} + + ); -ListActions.propTypes = { - basePath: PropTypes.string, - className: PropTypes.string, - currentSort: PropTypes.shape({}), - displayedFilters: PropTypes.shape({}), - exporter: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]), - filters: PropTypes.element, - filterValues: PropTypes.shape({}), - hasCreate: PropTypes.bool, - resource: PropTypes.string, - onUnselectItems: PropTypes.func.isRequired, - selectedIds: PropTypes.arrayOf(PropTypes.any), - showFilter: PropTypes.func, - total: PropTypes.number, -}; - ListActions.defaultProps = { selectedIds: [], onUnselectItems: () => null,