Skip to content

use_ref with canvas #1134

Answered by Archmonger
slauko asked this question in Question
Aug 25, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

It seems like this might require us to add some more features to reactpy.html.canvas.

With ReactJS, it will "fill in" the canvas context into the ref=... you provide. We currently do not have an equivalent feature in ReactPy. Currently, all props provided to ReactPy are serialized and sent to the client as-is. The issue you're seeing is that a Ref object is not serializable, which is true since it's a Python object.

Currently we have no mechanism that would enable ReactJS/ReactPy to intelligently "fill in" this ref. To add compatibility for this feature, ReactPy would need to start treating reactpy.html.canvas["ref"] as a unique prop.

In all likelihood, creating an equivalent API to ReactJS

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Archmonger
Comment options

Answer selected by Archmonger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants