title: Passing function as a param in react-navigation 5
body: <p><strong>NOTE:</strong> This query is for react-navigation 5.  </p>
  
  <p>In react navigation 4 we could pass a function as a param while navigating but in react navigation 5, it throws a warning about serializing params.  </p>
  
  <p>Basically, what I am trying to do is, navigate to a child screen from parent screen, get a new value and update the state of the parent screen.  </p>
  
  <p>Following is the way I am currently implementing:  </p>
  
  <p><strong>Parent Screen</strong>  </p>
  
  <pre><code>_onSelectCountry = (data) =&gt; {
      this.setState(data);
  };
  .
  .
  .
  
  &lt;TouchableOpacity
      style={ styles.countrySelector }
      activeOpacity={ 0.7 }
      onPress={ () =&gt; Navigation.navigate("CountrySelect",
          {
               onSelect: this._onSelectCountry,
               countryCode: this.state.country_code,
          })
      }
  &gt;
  .
  .
  .
  &lt;/TouchableOpacity&gt; 
  </code></pre>
  
  <p><strong>Child Screen</strong>  </p>
  
  <pre><code>_onPress = (country, country_code, calling_code) =&gt; {
      const { navigation, route } = this.props;
      navigation.goBack();
      route.params.onSelect({
          country_name: country,
          country_code: country_code,
          calling_code: calling_code
      });
  };
  </code></pre>