Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
danez authored Apr 17, 2022
1 parent 20a4ba0 commit 1c0fe12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,18 @@ Possible values for tabsRole are:
- Tab
- TabPanel
- TabList
- Tabs
#### Pass through properties
Note: Because of how react-tabs works internally (it uses cloning to opaquely control various parts of the tab state), you need to pass any incoming props to the component you're wrapping. The easiest way to do this is to use the rest and spread operators, e.g. see `{...otherProps}` below.
```javascript
```tsx
import { Tabs, TabList, Tab, TabPanel } from 'react-tabs';
import type { ReactTabsFunctionComponent, TabProps } from 'react-tabs';
// All custom elements should pass through other props
const CustomTab = ({ children, ...otherProps }) => (
const CustomTab = ({ children, ...otherProps }): ReactTabsFunctionComponent<TabProps> => (
<Tab {...otherProps}>
<h1>{children}</h1>
</Tab>
Expand Down

0 comments on commit 1c0fe12

Please sign in to comment.