title: How to handle deep linking in react native / expo
body: <p>I have posted about this previously but still struggling to get a working version.</p>
  
  <p>I want to create a sharable link from my app to a screen within my app and be able to pass through an ID of sorts.</p>
  
  <p>I have a link on my home screen opening a link to my expo app with 2 parameters passed through as a query string</p>
  
  <pre><code>const linkingUrl = 'exp://192.168.0.21:19000';
  
  ...
  
  _handleNewGroup = async () =&gt; {
    try {
      const group_id = await this.createGroupId()
      Linking.openURL(`${linkingUrl}?screen=camera&amp;group_id=${group_id}`);
    }catch(err){
      console.log(`Unable to create group ${err}`)
    }
  };
  </code></pre>
  
  <p>Also in my home screen I have a handler that gets the current URL and extracts the query string from it and navigates to the camera screen with a <code>group_id</code> set</p>
  
  <pre><code>async handleLinkToCameraGroup(){  
    Linking.getInitialURL().then((url) =&gt; {
      let queryString = url.replace(linkingUrl, '');
      if (queryString) {
        const data = qs.parse(queryString);
        if(data.group_id) {
          this.props.navigation.navigate('Camera', {group_id: data.group_id});
        } 
      }
    }).catch(err =&gt; console.error('An error occurred', err));
  }
  </code></pre>
  
  <p>Several issues with this:</p>
  
  <ol>
  <li>Once linked to the app with the query string set, the values don't get reset so they are always set and therefore <code>handleLinkToCameraGroup</code> keeps running and redirecting.</li>
  <li><p>Because the URL is not an http formatted URL, it is hard to extract the query string. Parsing the query string returns this:</p>
  
  <p>{
    "?screen": "camera",
    "group_id": "test",
  }</p></li>
  <li><p>It doesn't seem right having this logic in the home screen. Surely this should go in the app.js file. But this causes complications not being able to use <code>Linking</code> because the <code>RootStackNavigator</code> is a child of app.js so I do not believe I can navigate from this file?</p></li>
  </ol>
  
  <p>Any help clarifying the best approach to deep linking would be greatly appreciated.</p>