11import { useEffect , useState } from 'react' ;
2- import { ChatClient , Reaction as ReactionInterface , RoomReactionEvent } from '@ably/chat' ;
2+ import { ChatClient , RoomReaction as ReactionInterface , RoomReactionEvent } from '@ably/chat' ;
33import { ChatClientProvider , ChatRoomProvider , useRoom , useRoomReactions } from '@ably/chat/react' ;
44import { Realtime } from 'ably' ;
55import './styles/styles.css' ;
@@ -14,7 +14,7 @@ function Chat() {
1414 const [ reactions , setReactions ] = useState < ReactionInterface [ ] > ( [ ] ) ;
1515 const emojis = [ '❤️' , '😲' , '👍' , '😊' ] ;
1616
17- const { send } = useRoomReactions ( {
17+ const { sendRoomReaction } = useRoomReactions ( {
1818 listener : ( reactionEvent : RoomReactionEvent ) => {
1919 const reaction = reactionEvent . reaction ;
2020 setReactions ( ( prevReactions : ReactionInterface [ ] ) => [ ...prevReactions , { ...reaction } ] ) ;
@@ -35,7 +35,7 @@ function Chat() {
3535 < div className = "border-t-2 border-gray-200 px-4 pt-4 mb-2 sm:mb-0" >
3636 < div className = "emoji-selector" >
3737 { emojis . map ( ( emoji , index ) => (
38- < span key = { index } className = "emoji-btn" onClick = { ( ) => send ( { name : emoji } ) } >
38+ < span key = { index } className = "emoji-btn" onClick = { ( ) => sendRoomReaction ( { name : emoji } ) } >
3939 { emoji }
4040 </ span >
4141 ) ) }
0 commit comments