Skip to content

How can I create protected routes? #28

Answered by Archmonger
RWallan asked this question in Question
Discussion options

You must be logged in to vote

Routes can be protected within the individual components that render those routes.

For example,

from reactpy import component, html

@component
def example():
    if condition_is_met:
       # You can either redirect via scripts or just return None.
       return html.script('window.location.href = "/my_url/";')

    return ... # Your ReactPy application

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RWallan
Comment options

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