chat app #3b - menghubungkan UI dengan graphql API
install recoil npm install recoil src/recoil.js import { atom } from "recoil"; export const selectedUserState = atom({ key: "selectedUser", default: null, }); src/pages/Main/Message/index.js setTimeout(() => { const cb = document.getElementById("chat-content").parentElement; if (cb) { cb.scrollTop = cb.scrollHeight; } }, 200); updated query (src/pages/Main/Message/index.js) subscription MyQuery($where: messages_bool_exp = {}) { messages(where: $where, order_by: { createdAt: asc }) { id fromUserId message fromUser { name picture } createdAt } } update variable params (src/pages/Main/Message/index.js) let params = { where: {} }; if (selectedUser && !selectedUser.id) { params.where = { toUserId: { _is_null: true, }, }; } else if (selectedUser && selectedUser.id) { params.wh