Closed evansendra closed 9 months ago
I think the children are getting mapped so avoid abstracting it into its own component. Haven't used this in a long time though so I forget tbh
Thanks for your super quick reply @nandorojo. I think without that abstraction it becomes impossible to use the hooks based on https://github.com/coinjar/react-native-wagmi-charts?tab=readme-ov-file#hooks:
"The following hooks are only accessible inside the LineChart.Provider or CandlestickChart.Provider"
Will dig into it a bit more to see what's happening within the library when it checks for IDs
I think you can check the source it should be an easy fix, I might also be wrong
Yep it was an easy fix and my incorrect hook usage. Looking into the source a bit the line chart hooks have to be used within children of <LineChart>
in order to have IDs correctly provisioned. Will add some code in this comment for an example in case I delete the example repo later.
Using a
<LineChart.Group>
with multiple<LineChart id="...">
children is fine. However when moving the<LineChart id="...">
components into a child component so they have access to the<LineChart.Provider data={{ ... }}>
, it seems that the id is missing from within the hooks:This error disappears when the hook is removed. Is it a setup issue in how I'm using the hook with multiple line charts? @nandorojo I think you originally added this feature in #31 if you have any guidance it would be much appreciated 🙏
Repo to demonstrate issue: https://github.com/evansendra/wagmi-multichart-example