title: react-chart2: Cannot read properties of undefined (reading 'map')
body: <p>I'm trying to create a bar chart with react-chartjs-2, but I'm receiving error:
  Cannot read properties of undefined (reading 'map').
  It's the first time I'm trying to create a Chart and I'm wondering what should I write differently, what is causing this error.</p>
  <p><a href="https://i.stack.imgur.com/v1L9X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v1L9X.png" alt="enter image description here" /></a></p>
  <pre><code>import React, {useEffect} from 'react'
  import styled from 'styled-components';
  import {Bar} from 'react-chartjs-2';
  
      const ChartDaily = ({dailyPrices, chartData, setChartData}) =&gt; {
      
          const Chart = () =&gt; {
      
              setChartData({
                    labels: ['Open', 'High', 'Low', 'Close', 'Volume'],
                    datasets: [{
                        label: 'price',
                        data : [1, 100, 1000, 10000],
                        backgroundColor: [
                            'rgba(54, 162, 235, 1)',
                            'rgba(255, 206, 86, 1)',
                            'rgba(75, 192, 192, 1)',
                            'rgba(153, 102, 255, 1)',
                            'rgba(255, 159, 64, 1)',
                        ],
                        borderColor: [
                            'rgba(54, 162, 235, 1)',
                            'rgba(255, 206, 86, 1)',
                            'rgba(75, 192, 192, 1)',
                            'rgba(153, 102, 255, 1)',
                            'rgba(255, 159, 64, 1)',
                        ],
                        borderWidth:1
            
                    }]
                })
            
        
            }
      
            useEffect(() =&gt; {
                Chart();
            }, [])
            
      
          return (
              &lt;StyledChart&gt;
                  &lt;h3&gt;Daily Prices&lt;/h3&gt;
                  &lt;Bar
                          data={chartData}
                          options={{
                              responsive:true,
                              title: { text: &quot;Daily Chart&quot;, display: true },
                              scales:{
                                  yAxes:{
                                      ticks:{
                                          beginAtZero: true
                                      }
                                  }
                              }
                          }}
                        /&gt;
               &lt;/StyledChart&gt;
          )
      }
  </code></pre>