3 ms·
I'm curious about what you mean when you mention it not being "react friendly". I didn't encounter any issues when simply putting the chart creation in a useEff
by zer0tonin 3y ago
I'm curious about what you mean when you mention it not being "react friendly". I didn't encounter any issues when simply putting the chart creation in a useEffect hook (that calls the chart.dispose function in callback).
- Octoth0rpe 3y agoThe solution you've mentioned - building your option object in an effect - is straightforward, but from my perspective very un-reacty. In some sense, the attributes in the option object will end up becoming various types of svg nodes. I can imagine that a more react-friendly implementation of e-charts would have components for each part of the option object. I also think echarts update process (setOption, merge/notMerge, etc) doesn't map very well to react's lifecycle concepts. That said, none of this is a dealbreaker from my perspective. It's an awesome library and it's _generally_ a joy to work with in react. But there's a bit of friction and that's ok.