visx
visx copied to clipboard
change examples to have passed-in data
Right now most of the examples I've seen use static data supplied by import
statements. But I think the examples themselves should take the data in as a prop instead, because that is how most people will need to write their components.
This has downstream effects because most of the uses of scales and data transformations are defined outside the React components, but this doesn't fly in real-world use cases, where useMemo
should be used instead.
Overall it just makes it more taxing to translate from examples when trying to build new charts.
Hey @ianstormtaylor thanks for checking out visx
and for this request. It's a lot of work to refactor 30+ examples in this way/we don't currently have the bandwidth to do that, but I'm happy to review any PRs refactoring examples in this way.
@ianstormtaylor Are you working on this? If not, I guess it would be something good for me to work on. @williaster Would you prefer all of the examples refactored in 1 pull request?
Hey @dennisja 👋 , sweet! I think it'd be easiest to review these as separate PRs because there's ~30 examples which would be a huge PR.
Hey @williaster and @dennisja I'm happy to tackle refactoring some of these examples in a separate PR as well, if more help is needed