This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// formValues | |
{ | |
"fname": "John", | |
"lname": "Doe", | |
"image": "https://via.placeholder.com/150", | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"first_name": "John", | |
"last_name": "Doe", | |
"avatar_url": "https://via.placeholder.com/150" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// non-fusion approach | |
const data = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// non-fusion approach | |
const data = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// non-fusion approach | |
const data = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fusion approach | |
const data = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
]; | |
/** | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = [ | |
1, | |
2, | |
3, | |
4, | |
5, | |
]; | |
/** | |
* |