title: React-chartjs-2 - Each dataset needs a unique key
body: <p>I am getting this warning when i try to render my chart with two datasets. (just a warning it renders fine)</p>
  <pre><code>[react-chartjs-2] Warning: Each dataset needs a unique key. By default, the &quot;label&quot; property on each dataset is used. Alternatively, you may provide a &quot;datasetKeyProvider&quot; as a prop that returns a unique key.
  </code></pre>
  <p>I see it says it tries to use label as a key but since i am putting a variable in there it is not guaranteed to be unique. I saw some solutions where people used Math.random() as a prop passed into the component but when i do this it removes one of my datasets. Is there a best practice on how to remove this warning?</p>
  <p>Thanks!</p>
  <pre><code>const data = {
      labels: [
        &quot;1MO&quot;,
        &quot;3MO&quot;,
      ],
      datasets: [
        {
          label: props.chartItems?.[0][&quot;create_date&quot;],
          data: [
            props.chartItems?.[0][&quot;one_month&quot;],
            props.chartItems?.[0][&quot;three_month&quot;],
          ],
          backgroundColor: &quot;red&quot;,
          borderColor: &quot;red&quot;,
          fill: false,
          lineTension: 0,
          radius: 8,
        },
        {
          label: props.chartItems?.[1][&quot;create_date&quot;],
          data: [
            props.chartItems?.[1][&quot;one_month&quot;],
            props.chartItems?.[1][&quot;three_month&quot;],
          ],
          backgroundColor: &quot;green&quot;,
          borderColor: &quot;lightgreen&quot;,
          fill: false,
          lineTension: 0,
          radius: 4,
        },
      ],
    };
  
    return (
      &lt;React.Fragment&gt;
        &lt;Line data={data} /&gt;
      &lt;/React.Fragment&gt;
    );
  </code></pre>