Base
Custom Components:https://reflex.dev/docs/custom-components/
# 初始化项目
reflex init
# 运行
reflex run
Reflex will hot reload any code changes in real time
import reflex as rx
术语
Components 组件:构建应用程序用户界面(UI)的基础元素
def round_button():
return rx.button(
rx.text("This is a page"),
border_radius=",15px", font_size="18px"
)
- Children:嵌套在组件内的文本或其他 Reflex 组件;作为 positional arguments 传递
- Props:影响组件行为和外观的属性;作为 keyword arguments 传递。
States 状态:在应用程序中,需要存储和显示变量。rx.State
类用于存储在应用运行时可以变化的变量,以及可以改变这些变量的函数。
class MyState(rx.State):
count: int = 0
color: str = "red"