From 80899c48de066959b3b9d6b34f037ed527763531 Mon Sep 17 00:00:00 2001 From: levente kiraly Date: Fri, 21 Apr 2023 11:37:46 +0200 Subject: [PATCH] refactor: use default parameters --- src/components/Tab.js | 9 ++++++--- src/components/TabList.js | 7 +++++-- src/components/TabPanel.js | 7 +++++-- src/components/Tabs.js | 20 ++++++++++++++------ src/components/UncontrolledTabs.js | 8 ++++++-- 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/components/Tab.js b/src/components/Tab.js index f120b891a7..b9d023e01f 100644 --- a/src/components/Tab.js +++ b/src/components/Tab.js @@ -47,7 +47,10 @@ const Tab = (props) => { tabIndex, tabRef, ...attributes - } = props; + } = { + ...defaultProps, + ...props, + }; useEffect(() => { if (selected && focus) { @@ -78,8 +81,8 @@ const Tab = (props) => { ); }; -Tab.propTypes = propTypes; +Tab.propTypes = propTypes; Tab.tabsRole = 'Tab'; -Tab.defaultProps = defaultProps; + export default Tab; diff --git a/src/components/TabList.js b/src/components/TabList.js index 425bc83178..f4686434c2 100644 --- a/src/components/TabList.js +++ b/src/components/TabList.js @@ -14,7 +14,10 @@ const propTypes = { ]), }; const TabList = (props) => { - const { children, className, ...attributes } = props; + const { children, className, ...attributes } = { + ...defaultProps, + ...props, + }; return (