title: Export data in excel format in React
body: <p>I've managed to export the data in csv format but I'm struggling to do in in xls/xlsx/excel format.</p>
  <p>There are 2 radio buttons for changing the state value from csv to xls and back, and based on that value the ternary know which format should use for the export.</p>
  <p>The csv part works fine but I don't know what to write in order to do the xls export.</p>
  <p>Something must be added in the second part of this ternary operator:</p>
  <pre><code>{data.exportType === 'csv' ? (
    &lt;CSVLink {...csvReport}&gt;export CSV&lt;/CSVLink&gt;
  ) : (
    &lt;div&gt;export XLS&lt;/div&gt;
  )}
  </code></pre>
  <p>This is the component:</p>
  <pre><code>import React, { useState } from 'react';
  import { useSelector, shallowEqual } from 'react-redux';
  import { OutlineButton, RadioButton } from '@thermofisher/react-komodo-design';
  import './style.scss';
  import { CSVLink } from 'react-csv';
  
  const ExportOrders = () =&gt; {
    const initialData = {
      exportType: 'xls',
      page: 0
    };
    const [data, setData] = useState(initialData);
  
    const orders = useSelector(
      (state) =&gt; state.deferredPayments.orderLines,
      shallowEqual
    );
  
    const csvReport = {
      data: orders,
      filename: 'result.csv'
    };
  
    const onChangeHandler = (e, type) =&gt; {
      const name = e.target.name;
  
      setData({
        ...data,
        [name]: type
      });
    };
  
    const handleSubmit = (e) =&gt; {
      e.preventDefault();
    };
  
    return (
      &lt;form onSubmit={handleSubmit} className=&quot;export-container&quot;&gt;
        &lt;div className=&quot;c-radio-container&quot;&gt;
          &lt;RadioButton
            name=&quot;exportType&quot;
            checkedValue={data.exportType}
            value=&quot;xls&quot;
            onChange={(e) =&gt; onChangeHandler(e, 'xls')}
            inline&gt;
            XLS
          &lt;/RadioButton&gt;
          &lt;RadioButton
            name=&quot;exportType&quot;
            checkedValue={data.exportType}
            value=&quot;csv&quot;
            onChange={(e) =&gt; onChangeHandler(e, 'csv')}
            inline&gt;
            CSV
          &lt;/RadioButton&gt;
        &lt;/div&gt;
  
        &lt;OutlineButton&gt;
          {data.exportType === 'csv' ? (
            &lt;CSVLink {...csvReport}&gt;export CSV&lt;/CSVLink&gt;
          ) : (
            &lt;div&gt;export XLS&lt;/div&gt;
          )}
        &lt;/OutlineButton&gt;
      &lt;/form&gt;
    );
  };
  
  export default ExportOrders;
  </code></pre>
  <p>Any ideas?</p>