Effects and async
Side effects bound to a component lifetime, and a typed helper for async loads.
Gova offers two hooks for side effects: UseEffect for arbitrary imperative
work with cleanup, and UseAsync for one-shot loads whose result is bound to
the view.
UseEffect
The callback runs once per mount. The context.Context is cancelled when the
component unmounts. If the callback returns a non-nil function, that function
runs on unmount.
UseEffect is call-site keyed just like State, so the same effect is not
rerun on every render; it is initialized once per mount.
UseAsync
Runs the function in a goroutine and returns (data, err, loading). The
first render returns the zero T, nil, and true. Once the goroutine
finishes the state is updated and the component rerenders with the final
(data, err, false) tuple.
The context is cancelled on unmount so the goroutine can exit cleanly.
Like UseEffect, UseAsync is call-site keyed; the goroutine is started on
first mount, not on every render.