How to use the useEffect function in react js chart 2 to change the labels?

๐Ÿ‘:0

selectionRange is a state, thus it needs to be included in dependency array:

useEffect(() => {
    setChartData({
        labels: dataDate(selectionRange),
        // ...
    })

}, [selectionRange]);

Leave a comment