Intrinsic callback naming
Contract
v0.1.12 renames interactive callback attributes to match HTML/DOM event
names as closely as Go syntax allows. GX uses on-prefixed camel-case names:
| Browser event | GX attribute | Go props field |
|---|---|---|
click |
onClick |
OnClick |
submit |
onSubmit |
OnSubmit |
input |
onInput |
OnInput |
change |
onChange |
OnChange |
The old bare callback spellings are removed, not kept as aliases. GX is a new
framework, so public examples, lint diagnostics, compiler lowering, generated
Go, runtime wiring, and test fixtures should use only the on* names.
package notesui
import "github.com/busdk/bus-gx/pkg/gx"
func NoteEditor(title string, setTitle func(string), save func()) gx.Node {
return (
<form onSubmit={save}>
<label for="title"><Text value={"Title"}></Text></label>
<input id="title" name="title" value={title} onInput={setTitle} />
<button type="submit"><Text value={"Save"}></Text></button>
</form>
)
}
Lowercase intrinsic elements store callback functions in
Props with the same attribute name, such as onClick or
onInput. Uppercase component calls map the same attribute names to Go fields
such as OnClick or OnInput.
Boundary
This patch changes names only. It does not add new event payload types, effect hooks, state hooks, expanded intrinsic elements, or resource helpers.