Skip to content

Commit 5023297

Browse files
11 - Pages and URL Routes
1 parent 1cac2f8 commit 5023297

4 files changed

Lines changed: 47 additions & 1 deletion

File tree

full_stack_python/full_stack_python.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import reflex as rx
44

55
from rxconfig import config
6-
76
from .ui.base import base_page
87

8+
from . import pages
9+
910
class State(rx.State):
1011
"""The app state."""
1112
label = "Welcome to Reflex!"
@@ -46,5 +47,9 @@ def index() -> rx.Component:
4647
return base_page(my_child)
4748

4849

50+
51+
4952
app = rx.App()
5053
app.add_page(index)
54+
app.add_page(pages.about_page, route='/about')
55+
app.add_page(pages.pricing_page, route='/pricing')
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from .about import about_page
2+
from .pricing import pricing_page
3+
4+
__all__ = [
5+
'about_page',
6+
'pricing_page'
7+
]

full_stack_python/pages/about.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import reflex as rx
2+
3+
from ..ui.base import base_page
4+
5+
def about_page() -> rx.Component:
6+
my_child = rx.vstack(
7+
rx.heading("About Us", size="9"),
8+
rx.text(
9+
"Something cool about us.",
10+
),
11+
spacing="5",
12+
justify="center",
13+
align="center",
14+
min_height="85vh",
15+
id='my-child'
16+
)
17+
return base_page(my_child)

full_stack_python/pages/pricing.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import reflex as rx
2+
3+
from ..ui.base import base_page
4+
5+
def pricing_page() -> rx.Component:
6+
my_child = rx.vstack(
7+
rx.heading("Pricing", size="9"),
8+
rx.text(
9+
"Our Pricing",
10+
),
11+
spacing="5",
12+
justify="center",
13+
align="center",
14+
min_height="85vh",
15+
id='my-child'
16+
)
17+
return base_page(my_child)

0 commit comments

Comments
 (0)