Skip to main content
The Events SDK exposes the full events surface as React hooks: creating and editing events (with inline cover/gallery upload), listing them with a paginated wrapper, the RSVP lifecycle, and host/invite management. Hooks authenticate as the logged-in user — the server derives who is acting from the token, so you never pass an actor userId (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. Cover and gallery uploads are inline — pass a cover and/or gallery and the hook sends multipart/form-data automatically. The logged-in user 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. RSVPs close at startTime, are rejected on cancelled events, reject maybe when allowMaybe is false, and reject going at capacity.

See Also