FunRequestThe have the get, post, patch and delete methods
MethodDescriptionparameters
get()
To create a get request`url :any, headers:object`
post()
To create a post request`url:String, body:any, headers:object`
patch()
To create a patch request`url:String, body:any, headers:object`
delete()
To create a delete request`url:String, headers:object`
#
Simple get request
Lets send a simple get request to the url `https://jsonplaceholder.typicode.com/users`, it will return a users profile and we will display the profile.
React / Next.js Show Source Code
Returned Data

#
Post Request
In this example, we will send a post request to `https://jsonplaceholder.typicode.com/posts`,

Data
{ title: 'foo', body: 'bar', userId: 1, }
React / Next.js Show Source Code
#
Patch Request
In this example, we will send a patch request to `https://jsonplaceholder.typicode.com/posts/1`,

Data
{ title: 'Patch Request', body: 'This is the content of the data', userId: 1, }
React / Next.js Show Source Code
#
Delete Request
In this example, we will send a delete request to `https://jsonplaceholder.typicode.com/posts/1`,
React / Next.js Show Source Code