title: Two function inside one function one as props and one as function
body: <p>I am creating a common component for calendar. I need to call two function inside one function like:-</p>
  <pre><code>onDateChange = {()=&gt;{ props.onDateChange,setShowCal()}}
  </code></pre>
  <p>so <code>setShowCal()</code> can close the calendar once selected and <code>props.onDateChange</code> give selected date in parent component.</p>
  <p>but only <code>setShowCal()</code> is working and <code>props.onDateChange</code> is not working.</p>
  <p>Full code of common component :-</p>
  <pre><code>export const PrimaryCalendar = (props)=&gt;{
  const [showCal, setShowCal] = React.useState(false);
  const mindate = new Date();
  const showCalendar = ()=&gt;{
      setShowCal(!showCal)
  }
  return(
      &lt;View&gt;
      {(showCal) ? 
          &lt;View style={styles.container}&gt;
          &lt;CalendarPicker
          selectedDayColor=&quot;#079B2B&quot;
          minDate = {mindate}
          startFromMonday={true}
          allowRangeSelection={true}
          todayBackgroundColor=&quot;#79AE08&quot;
          previousTitle=&quot;Previous&quot;
            nextTitle=&quot;Next&quot;
          onDateChange = {()=&gt;{ props.onDateChange,setShowCal()}}
          /&gt;
          &lt;/View&gt;
      :
      &lt;View&gt;
      &lt;TouchableOpacity style={styles.calendarInputContainer} onPress={()=&gt;showCalendar()}&gt;
          &lt;Text style={{color:'white', fontSize:25}}&gt;{props.title}&lt;/Text&gt;
          &lt;Icon name=&quot;calendar&quot; size={30} color={'white'}/&gt;
          &lt;/TouchableOpacity&gt;
      &lt;/View&gt;
      }
          &lt;/View&gt;
  )
  </code></pre>
  <p>}</p>
  <p>How I can implement it?
  Thanks!!!</p>