Hackforge Academy

Category: React • Beginner

Published on 24 Feb 2026

Explanation

#white-PUT method is used to completely #white-update a resource.

Code Example

fetch('/users/1', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ name: 'Updated Name' })
});

Explanation

#white-PATCH method is used to partially update a resource.

Code Example

fetch('/users/1', {
  method: 'PATCH',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ email: 'new@mail.com' })
});

Explanation

#white-PUT replaces entire resource, #white-missing fields may be removed.

Code Example

// PUT replaces full object

Explanation

#white-PATCH modifies only specified fields.

Code Example

// PATCH updates only provided fields

Explanation

#white-Both PUT and PATCH are idempotent #white-if used correctly.

Code Example

// Multiple identical PUT calls result in same resource state

Want structured learning with real projects?

Join our Weekend Live Workshop and become job-ready faster.