Skip to content

Document and window #1222

Answered by Archmonger
stephanosn asked this question in Question
Discussion options

You must be logged in to vote

If you need direct access to the client-side DOM, I would recommend switching to reactpy-django and use pyscript_component.

Then, you'd be able to query the DOM within a use_effect hook with pyscipt's JS module.

import js

@use_effect
async def peroidic_polling():
    while True:
        if js.window.innerWidth < 1200:
            ...
        await asyncio.sleep(0.5)

I am working on migrating pyscript components to core, but a few other things are currently taking priority.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
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