pass props in tabs in react native

后端 未结 1 1265
执笔经年
执笔经年 2021-01-29 12:17

I would like to know how to pass a state from my main page to the Tabs? Currently I\'m using navigate to transfer props from one page to another page but from Tabs it seems I ca

1条回答
  •  无人及你
    2021-01-29 12:51

    Simply Pass the state as props like this:

    
    

    from there you can access it at your SampleComponent as props ;)

    inside SampleComponent you can try logging it:

    //this is the state from your mainPage
    const {sampleProps} = this.props; 
     console.log(sampleProps); 
    

    that should do it

    0 讨论(0)
提交回复
热议问题