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_session` hook #196

Closed Archmonger closed 7 months ago

Archmonger commented 11 months ago

Current Situation

There is no convenient method to fetch the Django and ReactPy sessions from within components.

Proposed Actions

Create a use_session hook.

This interface could either return a NamedTuple within ReactPy and Django session objects....

session = use_session()

return f"{session.django} {session.reactpy}"

Or, we could use two separate hooks...

django_session = use_django_session()
reactpy_session = use_reactpy_session()
Archmonger commented 7 months ago

Closing this since I currently see no reason anyone would want to access these sessions within a ReactPy component.

If anyone believes otherwise, feel free to comment on this issue and I'll reopen it.