reactive-python / reactpy-django

It's React, but in Python. Now with Django integration.
https://reactive-python.github.io/reactpy-django/
MIT License
322 stars 18 forks source link

`use_root_id` hook #203

Closed Archmonger closed 6 months ago

Archmonger commented 8 months ago

Current Situation

There is currently no convenient way to retrieve the id of the root component.

Proposed Actions

Create a use_root_id hook that fetches this value from the websocket or HTTP connection (pre-renders and regular renders). This is going to require building some additional infrastructure, since we currently only propagate the UUID to the component if it has template args/kwargs AND is using a websocket.