diff --git a/src/components/Tab.jsx b/src/components/Tab.jsx index 91401a9268..2f23fb2f05 100644 --- a/src/components/Tab.jsx +++ b/src/components/Tab.jsx @@ -2,14 +2,6 @@ import React, { useEffect, useRef } from 'react'; import cx from 'clsx'; const DEFAULT_CLASS = 'react-tabs__tab'; -const defaultProps = { - className: DEFAULT_CLASS, - disabledClassName: `${DEFAULT_CLASS}--disabled`, - focus: false, - id: null, - selected: false, - selectedClassName: `${DEFAULT_CLASS}--selected`, -}; /* Left for TS migration @@ -34,24 +26,20 @@ const propTypes = { tabRef: PropTypes.func, // private };*/ -const Tab = (props) => { +const Tab = ({ + children, + className = DEFAULT_CLASS, + disabled, + disabledClassName = `${DEFAULT_CLASS}--disabled`, + focus = false, + id = null, + selected = false, + selectedClassName = `${DEFAULT_CLASS}--selected`, + tabIndex, + tabRef, + ...attributes +}) => { let nodeRef = useRef(); - const { - children, - className, - disabled, - disabledClassName, - focus, - id, - selected, - selectedClassName, - tabIndex, - tabRef, - ...attributes - } = { - ...defaultProps, - ...props, - }; useEffect(() => { if (selected && focus) { diff --git a/src/components/TabList.jsx b/src/components/TabList.jsx index c3de9888fb..90b0dacf72 100644 --- a/src/components/TabList.jsx +++ b/src/components/TabList.jsx @@ -1,10 +1,6 @@ import React from 'react'; import cx from 'clsx'; -const defaultProps = { - className: 'react-tabs__tab-list', -}; - /* Left for TS migration const propTypes = { @@ -15,12 +11,12 @@ const propTypes = { PropTypes.object, ]), };*/ -const TabList = (props) => { - const { children, className, ...attributes } = { - ...defaultProps, - ...props, - }; +const TabList = ({ + children, + className = 'react-tabs__tab-list', + ...attributes +}) => { return (