GX Framework

Effects

Actions and resources are the host-facing effect layer around a pure render tree. Use them when a component needs to trigger work, fetch data, or hand a request to the runtime instead of only emitting HTML. The code sample keeps the alias short, but the page treats this as a boundary surface rather than a primary public component API.

What belongs here

Keep user-visible actions, request normalization, and response wiring separate from the node tree itself. That keeps rendering deterministic while still letting the runtime handle side effects.

state := ui.NewActionState()
actions := ui.ActionSet[string]{
  "files.refresh": {
    Token: "files.refresh",
    RunResult: func(moduleID string) ui.Result {
      return ui.Success(map[string]string{"module": moduleID})
    },
  },
}

result := ui.RunAction(actions, state, "files.refresh", "accounting")

Why it gets its own page

Effects are the piece programmers reach for when a component stops being pure and starts coordinating host work. Separating them keeps the render-tree pages focused on structure and the runtime pages focused on mounting.

See also Runtime mounting and Rendering.