useReactions
function useReactions( activityId, initialCounts?, initialOwn?): object;Optimistic like/unlike counters. Inside a disabled provider, react/unreact are
full no-ops resolving undefined (no optimistic bump either) and enabled is false.
react(kind) / unreact(kind) reject after rolling back — see the file header.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
activityId |
string |
undefined |
initialCounts |
Record<string, number> |
{} |
initialOwn |
string[] |
[] |
Returns
Section titled “Returns”object
counts
Section titled “counts”counts: Record<string, number>;enabled
Section titled “enabled”enabled: boolean;ownReactions
Section titled “ownReactions”ownReactions: string[];react: (kind, opts?) => Promise<void>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
kind |
string |
opts? |
{ onError?: OptimisticOnError; } |
opts.onError? |
OptimisticOnError |
Returns
Section titled “Returns”Promise<void>
unreact
Section titled “unreact”unreact: (kind, opts?) => Promise<void>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
kind |
string |
opts? |
{ onError?: OptimisticOnError; } |
opts.onError? |
OptimisticOnError |
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”The network error after the optimistic update has been rolled back.