Search code examples
react-nativeparametersreact-functional-component

How to get or access navigation params in functional component in react native


I am new to react native. I have created 3 screen. one is login from where I navigate to 2 screens. first screen is class based component and second screen is functional based component. Now I can get params in class component screen like this = >

const leadTagNumber = this.props.route.params.leadTagNumber

here is working fine but Now I want to get that params in functional component too. so how to do that in functional component. please help


Solution

  • use this syntax:

    
    function MyComp(props){
    
    //
       const yourParam = props.route.params.yourParam
    //
    }