Skip to content

Instantly share code, notes, and snippets.

@jaunesarmiento
Last active August 1, 2020 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaunesarmiento/b9ac60190e385d0422e4864062ee233d to your computer and use it in GitHub Desktop.
Save jaunesarmiento/b9ac60190e385d0422e4864062ee233d to your computer and use it in GitHub Desktop.
const [messages, setMessages] = useState([]);
useEffect(() => {
API
.graphql(graphqlOperation(listMessages))
.then((response) => {
const items = response.data?.listMessages?.items;
if (items) {
setMessages(items);
}
});
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment