Skip to content

Instantly share code, notes, and snippets.

View jmaicaaan's full-sized avatar

JM Santos jmaicaaan

  • Philippines
View GitHub Profile
// formValues
{
"fname": "John",
"lname": "Doe",
"image": "https://via.placeholder.com/150",
}
// Updating the first approach (non schema-based)
const handleSubmit = async ({
fname: firstName,
lname: lastName,
image: imageURL
}) => {
const response = await fetch('https://myserver.com/api/user', {
method: 'POST',
body: JSON.stringify({
{
"first_name": "John",
"last_name": "Doe",
"avatar_url": "https://via.placeholder.com/150"
}
// non schema-based
const handleResponse = async () => {
const response = await fetch('https://myserver.com/api/user/1');
const {
first_name: firstName,
last_name: lastName,
avatar_url: avatarURL,
} = await response.json();
return {
// non-fusion approach
const data = [
1,
2,
3,
4,
5,
];
// non-fusion approach
const data = [
1,
2,
3,
4,
5,
];
// non-fusion approach
const data = [
1,
2,
3,
4,
5,
];
// fusion approach
const data = [
1,
2,
3,
4,
5,
];
const data = [
1,
2,
3,
4,
5,
];
/**
*
const data = [
1,
2,
3,
4,
5,
];
/**
*