Wrapping Tab into React.FC prevents tab switching
See original GitHub issueI might be doing it wrong but I tried to wrap Tab
into another component as
import {Tab as BaseUITab, TabProps } from 'baseui/tabs';
const Tab: React.FC<TabProps> = ({ children }, props) => (
<BaseUITab overrides={{ Tab: { style: { flex: 1 } } }} {...props}>
{children}
</BaseUITab>
);
However, when this is used within <StatefulTabs>
tab switching stops working.
Example https://codesandbox.io/s/uncontrolled-tabs-usage-3e5y2 There are two usage types, first is my wrap attempt, second is typical documented approach to show it works just fine that way.
Tech | Version |
---|---|
Base UI | v9.4.2 |
- I have searched the issues of this repository and believe that this is not a duplicate.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Wrapping Tab into React.FC prevents tab switching #1948
I might be doing it wrong but I tried to wrap Tab into another component as import {Tab as BaseUITab, TabProps } from...
Read more >How can I stop text wrap in Tab.Screen react native
You can try changing some of the style props of the navigator and experimenting with the width. For example: <Tab.
Read more >How to Use Wrappers in Typescript React - Twilio
Learn about the importance of wrappers and practice using wrappers for a custom component in a Typescript React project.
Read more >React conditional rendering: 9 methods with examples
In React, you use curly braces to wrap an IIFE, put all the logic you want inside it, like an if...else , switch...
Read more >Optimizing React performance by preventing unnecessary re ...
Re-rendering React components unnecessarily can slow down your app and make the UI feel unresponsive. This article explains how to update ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have created more relevant followup here https://github.com/uber/baseweb/issues/3548
@chasestarr I’d still love to do it.
<Tab {...commonTabProps}
is only a workaround and is kind of repetitive, also it’s easy to forget to include default tab props.See https://codesandbox.io/s/baseweb-nklju?file=/src/example.tsx