title: Sorting .map in React?
body: <p>I have this code</p>
  <pre><code>const fields = [
      { key: FORM, field: GSN, items: forms, label: 'FORM' },
      { key: STRENGTH, field: GSN, items: strengths, label: 'DOSAGE' },
      { key: QUANTITY, field: QTY, items: quantities, label: 'QUANTITY' }
  ]
  </code></pre>
  <p>which is being called in with:</p>
  <pre><code>{fields.map(({ field, key, items }) =&gt; {
      const v = inputs[key]
      const item = items.find(i =&gt; i[field] === v || i[key] === v)
      return item ? (
          &lt;div key={key}&gt;
              {item[key]}
          &lt;/div&gt;
      ) : null
  })}
  </code></pre>
  <p>I am looking to sort the items. The items are only numbers, but no matter where I add <code>sort()</code>, it throws errors. What would be best practice for sorting the output in order from lowest to highest number?</p>