useLoadUserReactions
The purpose of useLoadUserReactions
hook is to fetch, load and update the user reaction resources.
This hook implements a lazy load technique. To fetch the resources you need to invoke the loadUserReactions
function
Example Usage:
const { reactionSpace } = useReactionSpace({ targetGroupId: "<Room ID>" });
const { loadUserReactions } = useLoadUserReactions({
reactionSpaceId: reactionSpace?.id,
});
const targetIds = useMemo(() => messages.map(({ id }) => id), [messages]);
useEffect(() => {
if (!targetIds.length) {
return;
}
loadUserReactions({ targetIds });
}, [targetIds]);
Hook Argument
reactionSpaceId
reactionSpaceId
Type | Default |
---|---|
String | No Default |
Hook Return Value
loadUserReactions
loadUserReactions
Type |
---|
Function of type: ({ targetIds }: { targetIds: string[]; }) => void |
Updated about 1 month ago