Skip to main content
The Events SDK exposes the full events surface as React hooks: creating and editing events (with inline cover, image and file upload), listing them with a paginated wrapper, the RSVP lifecycle, and host/invite management. The user who creates an event is its owner: only the owner adds or removes other hosts, and the owner or the space’s admins and moderators cancel or delete it; hosts edit it and manage invites. Hooks authenticate as the logged-in user — the server derives who is acting from the token, so you never send actingUserId (the only userId arguments are targets, on the host/invite hooks). All hooks are importable from @sublay/react-js, @sublay/react-native, and @sublay/expo.
Unlike entities, events have no Redux store. State is local: load a single event with EventProvider / useEvent, and paginate lists with useFetchManyEventsWrapper.
Requires the events bundle on the project. Space-scoping needs spaces, images need files-images, and notifications need notifications.

Hooks at a glance

Creating an event

useCreateEvent returns a callable. Uploads are inline — pass a coverFile, images (processed, with options) and/or files (stored as uploaded) and the hook sends multipart/form-data automatically. The logged-in user becomes the event’s owner and is auto-added as a host.
The required location fields follow type: online needs url; physical needs address or location; hybrid needs both. See useCreateEvent for the full parameter list.

Listing events

Use useFetchManyEventsWrapper for a ready-made paginated list with sort state and loadMore. Visibility is enforced server-side, so the list only contains events the current user may see.

RSVPing

Both return the updated Event with refreshed rsvpCounts and the caller’s userRsvp, except that withdrawing from an event the user can no longer see returns only { id, userRsvp: null }. RSVPs close at startTime, are rejected on cancelled events, reject maybe when allowMaybe is false, and reject going at capacity.

See Also