If you want to learn how to send http delete request with react then i will help you step by step instruction for sending http request using axios react. i will give you very simple example to send http delete request using axios and react.
Axios is a npm package and the provide to make http request from your application. in this example we will use "jsonplaceholder" api to delete data using axios package.
So, let's see bellow example code and preview:
Example Code:
import React from 'react'; import axios from 'axios'; export default class PostList extends React.Component { state = { posts: [] } componentDidMount() { axios.get(`https://jsonplaceholder.typicode.com/posts`) .then(res => { const posts = res.data; this.setState({ posts }); }) } deleteRow(id, e){ axios.delete(`https://jsonplaceholder.typicode.com/posts/${id}`) .then(res => { console.log(res); console.log(res.data); const posts = this.state.posts.filter(item => item.id !== id); this.setState({ posts }); }) } render() { return ( ) } }React Axios Delete Request Example - codewale.com
{this.state.posts.map((post) => ( ID Title Body Action ))} {post.id} {post.title} {post.body}
I hope it can help you...
Categories
PHP
(5)
Codeigniter
(5)
Laravel
(3)
JS
(1)
Angular JS
(5)
Node JS
(5)
Vue JS
(4)
React JS
(6)
jQuery
(5)
Javascript
(3)
jQuery UI
(6)
Wordpress
(1)
Python
(5)
Database
(1)
MySql
(5)
Mongo DB
(1)
DBMS
(1)
SQL
(5)
HTML
(1)
HTML 5
(5)
CSS
(5)
Bootstrap
(5)
Ajax
(5)
JAVA
(1)
JSON
(5)
Ubuntu
(5)
Server
(5)
Git
(3)
Google
(1)
Google Map
(7)
Google API
(1)
Elastic Search
(1)
Apache
(1)
Installation
(1)