Support `ref` prop

Open
#1,135 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, python, react
Domain
frontend

Research direction

Start by reading the original discussion in issue #1134 and the use_messenger hook plans linked from pull request #881. Determine whether ref support should use client-server communication or a server-side approach; done means an agreed, feasible equivalent to React's canvas ref behavior.

Written by the indexing model from the issue text.

Description

priority-2-moderate

Original discussion: #1134
cc: @slauko

Current Situation

With several tags such as canvas, ReactJS will "fill in" the 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.

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.

Proposed Actions

In all likelihood, creating an equivalent API to ReactJS <canvas ref=... /> would rely on our future plans for a use_messenger hook to allow for arbitrary client->server real-time communication.

There's also a chance we develop this fully server-sided, but that's probably not technologically feasible.

Dominant language
Python
Stars
8.1k
Forks
332
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reactive-python/reactpy

All issues in reactive-python/reactpy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.