0👍
Data is called as a function.
Make data as a state Object variable. like {"chart_PH":[], "chart_Dissolve":[]}
and set them using the function.
add your data variable inside your useEffect dependency array. For Ex: From [] to [data].
[] in dependency means, it will load only on the first render. [data] means, it will render every time the data changes.
- Chartjs-Chart.js unable to render the chart with data reactjs
- Chartjs-Chartisan/Laravel – > "Call to undefined method" error
Source:stackexchange.com