Back to the beginning
Circular references are easy in Grimoire. Just add the option argument for an eariler page.
Warning: Be careful about creating infinite loops. Grimoire will continue rendering pages as long as it's seeing a version of the state that hasn't previously been rendered.
@app.page(start=True)
def start(state, second):
state.message = "Hello, traveller"
return Div(
P("Hello, Grimoire!"),
Ul(Li(link("Go to the second page", second)))
), state
@app.page()
def second(state, start):
return Div(
P(f"message: {state.message}"),
Ul(Li(link("Start over", start)))
), state