3 ms·
That looked interesting but I didn't need the most important functionality it provides (click/touch handling, fancy text rendering, etc) so I stuck with just us
by avolcano 11y ago
That looked interesting but I didn't need the most important functionality it provides (click/touch handling, fancy text rendering, etc) so I stuck with just using the Canvas API. It's pretty simple to do in React: https://gist.github.com/thomasboyt/bcc496c823a01ac5f648 https://gist.github.com/thomasboyt/bcc496c823a01ac5f648
- simonw 11y agoI might be missing something here: what benefit does React bring in this example? If you're using canvas to render without any kind of virtual DOM, why use React at all?
- seivan 11y agoCan't you combine? Thinking it could be used for UI. Makes sense when you need more support, like localisation and other builtin stuff. Just guessing.
- avolcano 11y agoOh, nothing on its own in that tiny example. In practice, it's just a component that could be used in a larger application and can be easily tied into the same rendering and state trees.
- untog 11y agoFrom my understanding, React Canvas handles which parts to redraw for you. Redrawing the entire Canvas with each frame is not performant.