import React from 'react'; type Emoji = { native: string; unified: string; }; type Reaction = { native: string; unified: string; userName: string; }; /** * * A component to group user selected emojis and display them. * *  * * @example * * import EmojiReactions from "@bigbinary/neeto-molecules/EmojiReactions"; * const EmojiReactionsContainer = () => { * const [reactions, setReactions] = useState([ * { native: "😃", unified: "1f603", userName: "User 1" }, * { native: "😄", unified: "1f604", userName: "User 1" }, * ]); * * const createReaction = emoji => ({ * native: emoji.native, * unified: emoji.unified, * userName: user.name, * userId: user.id, * }); * * const onReactionClick = emoji => { * const reaction = findBy( * { unified: emoji.unified, userId: user.id }, * reactions * ); * if (reaction) { * setReactions(reactions.filter(item => item.unified !== reaction.unified)); * } else { * setReactions([...reactions, createReaction(emoji)]); * } * }; * * return ( *