Skip to content

Commit 7cf494a

Browse files
13 - Click Events and Reflex Redirect
1 parent fdb5428 commit 7cf494a

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

full_stack_python/full_stack_python.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def handle_title_input_change(self, val):
1616

1717
def did_click(self):
1818
print("Hello world did click")
19+
return rx.redirect('/about-us')
1920

2021
def index() -> rx.Component:
2122
# Welcome Page (Index)
@@ -26,18 +27,10 @@ def index() -> rx.Component:
2627
rx.code(f"{config.app_name}/{config.app_name}.py"),
2728
size="5",
2829
),
29-
# <button href='/about'></button>
30-
rx.link(rx.button("Check out our docs!"), href='/about'),
31-
# <input type='text' value='My value' />
32-
rx.input(
33-
default_value=State.label,
34-
on_click=State.did_click,
35-
on_change=State.handle_title_input_change,
36-
),
30+
# rx.button("About us", on_click=State.did_click),
3731
rx.link(
38-
rx.button("Check out our docs!"),
39-
href="https://reflex.dev/docs/getting-started/introduction/",
40-
is_external=True,
32+
rx.button("About us"),
33+
href='/about'
4134
),
4235
spacing="5",
4336
justify="center",

full_stack_python/pages/about.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from ..ui.base import base_page
44

5+
# @rx.page(route='/about')
56
def about_page() -> rx.Component:
67
my_child = rx.vstack(
78
rx.heading("About Us", size="9"),

0 commit comments

Comments
 (0)