简体   繁体   中英

Can i use destroy charts in React.js using Chart.js?

I've been trying to find how to destroy chart in React.js but i couldn't find any of way. Does anyone know how to do it??

Ok, so the component receive type prop? You can call it in the useEffect with deps array of this type prop. That is exactly what is the useEffect for. When type changes, you create side effect. (destroy and reinit chart)

https://chartjs.org/docs/latest/developers/api.html#destroy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM