reactpy icon indicating copy to clipboard operation
reactpy copied to clipboard

Client Side Python Components

Open rmorshea opened this issue 6 years ago • 2 comments

Because of ReactPy's granular core abstractions it should be possible to run ReactPy client-side with Pyodide or PyScript. Using ReactPy instead of a solution that relies on a transpiler could have some advantages:

  • Components can be run client-side or server-side without any changes
  • No need to fiddle with weird bugs caused by back transpilation

ReactPy's client already uses React to render its JSON serializable VDOM into an actual view, so if the DOM representation were already client-side (as it would be with Pyodide) it should be trivial to send that representation to React directly rather than over a websocket.

Here is a functioning gist that uses ReactPy client-side via PyScript: https://gist.github.com/rmorshea/c888e6e34519edababf49351c63c335e

rmorshea avatar Sep 03 '19 16:09 rmorshea

Looks like #245 has been fixed. Maybe we can try this out?

rmorshea avatar Apr 18 '21 21:04 rmorshea

Apparently NextJS's router manages to switch between client/server components fluidly.

rmorshea avatar Jun 19 '23 18:06 rmorshea