Overview
useEvent reads the event loaded by EventProvider from context, returning the event plus bound actions (updateEvent, deleteEvent, cancelEvent, setRsvp, withdrawRsvp). useEventData is the underlying hook the provider uses — call it directly when you want the same managed state without the provider/context.
useEvent
Call inside a descendant ofEventProvider.
useEvent returns a Partial<UseEventDataValues> (empty object outside a provider).
useEventData
Manage an event without the provider. Pass either a pre-fetchedevent or an eventId to fetch.
Parameters
Associations to expand when fetching by
eventId, as a single value or an array: "user", "space", "files", "userRsvp".Returns (both hooks)
The event.
undefined while loading, null if not found or inaccessible — also after the event is deleted, and after a cancel or withdraw answers with a short body because the user can no longer see it. Such an event stays null for that eventId: the hook doesn’t fetch it again.Update mutable fields, the cover, images and files. Takes the changes alone, e.g.
updateEvent({ capacity: 150 }): the fields of useUpdateEvent without eventId. Hosts who are active members of the event’s space.Cancel the event (its owner, or the space’s admins and moderators). Resolves with the event, or with
{ id, status: "cancelled" } when the user can’t see it, which sets event to null.Withdraw the caller’s RSVP. Resolves with the event, or with
{ id, userRsvp: null } when the user can no longer see it, which sets event to null.space and files it was fetched with stay, and the result is kept for when the hook comes back to the same eventId.

