title: sending data from one function too another in a different component in another folder
body: <p>I have state from my LineContent.js which is in a seperate folder. It  contains an onclick from an a component inside the LineContent(  ). I want to grab the same data from the onNodeClick and pass it to a different component in a different folder..Here is what I mean:</p>
  <p>Here is my folder structure:</p>
  <pre><code>LineageContent
  --LineageContent.js
  
  ModalBar:
  --ModalBar.js
  </code></pre>
  <p>The onNodeClick is stored in the lineage content, data is retrieved from lineage content and I want to pass it too modal topBar.</p>
  <p>LineageContent.js</p>
  <pre><code> const onNodeClick = async (e) =&gt; {
      if (lineage.lineageMode === 'SQL') {
        let children = []
        if (e.children) children = e.children.map(c =&gt; c.name)
        if (e.__children) children = e.__children.map(c =&gt; c)
        let data = {asset_id: e.asset_id, assettitle: e.assettitle, asset_type: e.asset_type, children: children}
        loading.setLoading(true)
        const results = await get(`sqls/${e.asset_id}?refs=${children.join(',')}`, user.user)
        data.sql = results
        postLog('miscellaneous_class,SQL Modal', user.user)
        setShowSqlModal(true)
        setSqlData(data)
        loading.setLoading(false)
      } else if (lineage.lineageMode === 'Drill') {
        const path = `${siteUrl}?asset_id=${e.asset_id}&amp;asset_title=${e.assettitle}&amp;asset_type=${e.asset_type}`
        window.open(path, '_blank').focus()
        postLog('lineage_class,Lineage Vizual', user.user, e.asset_id)
      }
    }
  
  return (
  
      &lt;/div&gt;
            &lt;LineageTree
              id='lineage'
              zoomHeight={lineage.lineageZoom.height}
              zoomWidth={lineage.lineageZoom.width}
              lineageData={lineage.lineageData.lineage}
              mode={lineage.lineageMode}
              nodeClick={onNodeClick}
            /&gt;
          &lt;/div&gt;
  
  )
  </code></pre>
  <p>I have copied and pasted the function to the topModal component, but obviously that does not work as there is no e target. I don't want to have the LineageTree component in the topModal component as it is a shortcut so I was wondering how I could get the e values from the onNodeClick in the lineagecontent file to the topModal component.</p>
  <pre><code>  const onNodeClick = async (e) =&gt; {
  
      const line = await lineage 
      console.log(line, 'from line');
  
      assetDetails.onLineageClick('SQL')
  
      if (lineage.lineageMode === 'SQL') {
        let children = []
        if (e.children) children = e.children.map(c =&gt; c.name)
        if (e.__children) children = e.__children.map(c =&gt; c)
        let data = {asset_id: e.asset_id, assettitle: e.assettitle, asset_type: e.asset_type, children: children}
        loading.setLoading(true)
        const results = await get(`sqls/${e.asset_id}?refs=${children.join(',')}`, user.user)
        data.sql = results
        postLog('miscellaneous_class,SQL Modal', user.user)
        setShowSqlModal(true)
        setSqlData(data)
  
        loading.setLoading(false)
      } 
    }
  
  return(
        {!(['EDH Table', 'Report'].includes(assetType) &amp;&amp; assetDetails.usageMode !== 'Review') ? null :
            &lt;div&gt;
                &lt;Button text='Get SQL' className='CircleButton ModalTopbarButton' onClick={onNodeClick} /&gt;
                &lt;SqlModal showSqlModal={showSqlModal} sqlData={sqlData} onCloseSqlModal={onCloseSqlModal} /&gt;
            &lt;/div&gt;
            }
  
  )
  </code></pre>