Chartjs-Why is only a single chart of three updated with react-chartjs-2?

0๐Ÿ‘

โœ…

I played a little bit with your code and it seems like in chart.js file, you need to move your var chartReference inside your main function ( function charts() ) for all three to update.

export default function charts(props) {
  var chartReference = {};
  useEffect (() => {
...

My guess is that when your chartReference is outside the function, it ends up referring to only one of your charts.

Leave a comment