You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a really super simple chart that I generate from some data from web service, I pass the data into the component and I'm using the useEffect hook to render the chart. Here's the code:
So when I call the service, the data definitely comes back, and I can see the chart, with the Y-axis correctly scaled to the data, but I just don't see any bar values.
Maybe I'm missing something else. Can you point me in the right direction. Thanks for your help.
The text was updated successfully, but these errors were encountered:
Try just setting the data in as state and rendering the BarChart directly with the state passed in as a prop. I'm unfamiliar with setting a component as a state value, but that seems like an anti-pattern.
Also make sure your useEffect is being called again once the service call completes, it looks like for the wrapping component it will only set the data once on mount, but will not update if the property changes due to [] as your second parameter in useEffect.
Hi Jay,
I have a really super simple chart that I generate from some data from web service, I pass the data into the component and I'm using the useEffect hook to render the chart. Here's the code:
So when I call the service, the data definitely comes back, and I can see the chart, with the Y-axis correctly scaled to the data, but I just don't see any bar values.
Maybe I'm missing something else. Can you point me in the right direction. Thanks for your help.
The text was updated successfully, but these errors were encountered: