This was a great way to learn about Amplify. Is there a way to run the frontend on AWS Lambda? I'm hoping to keep this around with minimal cost. Thanks
Nice blog! I also recommend to update index.js to avoid duplicate subscription that Gabriel E mentioned too.
// Subscribe to creation of message
const subscription = API.graphql(
graphqlOperation(onCreateMessage)
).subscribe({
next: ({ provider, value }) => {
setStateMessages((stateMessages) => [
...stateMessages,
value.data.onCreateMessage,
]);
},
error: (error) => console.warn(error),
});
return () => subscription.unsubscribe()
}, []);
Great blog, thank you. One minor recommendation, to unsubscribe from subscription (or even within a timer).
return () => {
subscription.unsubscribe();
}
Rashan Jones
Great blog! Worked perfectly! How can I have this hosted in the cloud? Not sure how to deploy this to Amplify so I can use the production link?
Thank you.