title: Passing Parameters of a Function React
body: <p>In my application, I want to conditionally render something, so I made a function <code>getItem</code> which I want to call in my custom Tooltip, <code>const CustomTooltip</code>.</p>
  <p>Seen in the code below, I want to pass <code>payload</code> in <code>const CustomTooltip = ({ active, payload, label}</code> to <code>function getState({payload}</code></p>
  <p>I try to do this by <code>{getState(payload, &quot;A&quot;)}</code> However, when I do so, I get this error:</p>
  <p>Type 'Payload&lt;ValueType, NameType&gt;[]' has no properties in common with type 'TooltipProps&lt;ValueType, NameType&gt;'</p>
  <p>Note: I am new to React</p>
  <pre><code>  const numberStates = 3;
    function getState({payload}: TooltipProps&lt;ValueType, NameType&gt;, state: string ){
      if(payload){
        for(let i = 0; i &lt; numberStates; i++){
          if(payload[i].dataKey == state){
            return &lt;p&gt;{ payload[i] } : { payload[i].value }&lt;/p&gt;
          }
        }
      }
      return null;
    }
  
    const CustomTooltip = ({ active, payload, label}: TooltipProps&lt;ValueType, NameType&gt;) =&gt; {
      if(active &amp;&amp; payload &amp;&amp; payload.length){
        return (
          &lt;div className = &quot;custom-tooltip&quot;&gt;
            {getState(payload, &quot;A&quot;)}
            {getState(payload, &quot;B&quot;)}
            {getState(payload, &quot;C&quot;)}
          &lt;/div&gt;
        );
      }
      return null;
    }
  </code></pre>