Skip to content

Commit f51451e

Browse files
committed
readme updated with new syntax
1 parent 5d1e06b commit f51451e

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pip install evolve
5050

5151
## Quick Start
5252

53-
Get a reactive app running in seconds using the CLI.
53+
Get a reactive app running in seconds.
5454

5555
### 1\. Initialize a Project
5656

@@ -59,6 +59,8 @@ evolve init my-app
5959
cd my-app
6060
```
6161

62+
This creates a simple `app.py` with example routes.
63+
6264
### 2\. Run the Dev Server
6365

6466
```bash
@@ -73,15 +75,13 @@ Visit `http://localhost:3000` to see your app.
7375
evolve build
7476
```
7577

76-
This compiles your Python code and assets into the `dist/` folder, ready for static hosting.
78+
This compiles your app into `.evolve/dist/`, ready for static hosting.
7779

7880
-----
7981

8082
## The "Hello World" Component
8183

82-
Evolve uses a functional component syntax inspired by React but powered by Python.
83-
84-
`pages/home.py`:
84+
Evolve uses a FastAPI-style decorator syntax. Create an `app.py` anywhere:
8585

8686
```python
8787
from evolve.router.router import page
@@ -93,17 +93,22 @@ def Home():
9393
# Reactive state (Signals)
9494
count = signal(0)
9595
96-
def increment():
96+
def increment(ev=None):
9797
count.set(count() + 1)
9898
9999
return div(
100100
h1("Welcome to Evolve 🧬"),
101-
p(f"Current count is: {count()}"),
102-
button("Increment", on_click=lambda: increment()),
103-
style={"text-align": "center", "font-family": "sans-serif"}
101+
p(lambda: f"Count: {count()}"), # Reactive text
102+
button("Increment", on_click=increment),
103+
style={"textAlign": "center", "fontFamily": "sans-serif"}
104104
)
105105
```
106106

107+
Run it:
108+
```bash
109+
evolve run app.py
110+
```
111+
107112
-----
108113

109114
## Key Features
@@ -118,8 +123,8 @@ from evolve.reactive.reactive import signal, computed
118123
count = signal(0)
119124
double = computed(lambda: count() * 2)
120125
121-
# Only this text node updates in the DOM
122-
span(f"Double is: {double()}")
126+
# Use lambda for reactive text that updates automatically
127+
span(lambda: f"Double is: {double()}")
123128
```
124129
125130
### 2\. Built-in Routing

0 commit comments

Comments
 (0)