Guest User

Untitled

a guest
Sep 17th, 2020
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     class Panels extends React.Component {
  2.         constructor(props) {
  3.           super(props);
  4.      
  5.           this.state = {
  6.             activePanel: 'panel1'
  7.           }
  8.         }
  9.      
  10.         render() {
  11.           return (
  12.             <View activePanel={this.state.activePanel}>
  13.               <Panel id="panel1">
  14.                 <PanelHeader>Panel 1</PanelHeader>
  15.                 <Group>
  16.                   <CellButton onClick={ () => this.setState({ activePanel: 'panel2' }) }>
  17.                     Go to panel 2
  18.                   </CellButton>
  19.                 </Group>
  20.               </Panel>
  21.               <Panel id="panel2">
  22.                 <PanelHeader>Panel 2</PanelHeader>
  23.                 <Group>
  24.                   <CellButton onClick={ () => this.setState({ activePanel: 'panel3' }) }>
  25.                     Go to panel 3
  26.                   </CellButton>
  27.                 </Group>
  28.               </Panel>
  29.               <Panel id="panel3">
  30.                 <PanelHeader>Panel 3</PanelHeader>
  31.                 <Group>
  32.                   <CellButton onClick={ () => this.setState({ activePanel: 'panel1' }) }>
  33.                     Back to panel 1
  34.                   </CellButton>
  35.                 </Group>
  36.               </Panel>
  37.             </View>
  38.           )
  39.         }
  40.       }
  41.      
  42.    
  43.       export default Panels;
  44.  
Advertisement
Add Comment
Please, Sign In to add comment