Hide Tab in primereact

1

I have a component of primereact .

<TabView >
    <TabPanel header="Panel 1">
    </TabPanel>
    <TabPanel header="Panel 2">
    </TabPanel>
</TabView>

How can I show / hide a tab according to a specific value?

    
asked by nachfren 11.12.2018 в 10:04
source

1 answer

1

You can have a list of tabs to show and modify the list when it suits you:

const tabs = [1, 2]; //Esta lista es la que tienes que generar mirando condiciones

const listItems = tabs.map((number) =>
  <TabPanel header="Panel {number}"></TabPanel>
);

and then do something like

return (<TabView > {listItems} </TabView>);
    
answered by 11.12.2018 / 11:37
source