Skip to content
Advertisement

How to fix React Apex Chart initial mount delay?

I am using React Apex chart library in my project.I’ve figured that the library charts have a small delay before rendering on initial mount.

This issue harms the UX because the component that renders ApexCharts won’t be displayed until after the delay.

JavaScript

Is there a way to fix this ?

Advertisement

Answer

I figured out the solution.

To avoid the app rendering nothing in that delay and have a better UX, you can use a set timeout inside useEffect hook to update a state after the chart’s initial mount.

JavaScript
Advertisement