Counter
The smallest app with two screens: a counter and a details page that reads the id from the URL.
examples/counter on GitHubexamples/counter/app/index.py
from pyxpo import Button, Text, View, useState
from pyxpo.router import Link
def Index():
n, setN = useState(0)
return View(
Text("Count: ", n),
Button(title="Add", onPress=lambda: setN(n + 1)),
Link("Details", href="/details/%d" % n),
)
default = Index