Kirill Stas Kirill Stas - 1 year ago 255
React JSX Question

React: Fetch DELETE and PUT requests

I have gotten outside of GET and POST methods with Fetch. But I could find any good example of DELETE and POST example.

So, I ask you for it. Could you give a good example of DELETE and PUT methods with fetch. And a little bit explain it.

Answer Source

Here is a fetch POST example. You can do the same for DELETE :)

function createNewProfile(profile) {
    const formData = new FormData();
    formData.append('first_name', profile.firstName);
    formData.append('last_name', profile.lastName);
    fetch('', {
        method: 'POST',
        body: formData
    .then(response => response.json())
    .then((json) => {
        // handle success
    .catch(error => error);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download