SQlite data on to a table using Axios

Viewed 192
import React, {useState} from "react";
import axios from 'axios';

function TreatmentRecordPanel() {

const [treatId, setID] = React.useState('');
const [treatCourseId, setCourse] = 
React.useState('');
const [type, setType] = React.useState('');
const [category, setCatagory] = 
React.useState('');
const [Pname, setName] = React.useState('');
const [startDate, setDate] = 
React.useState('');




function patientTreatmentRecord(){




axios.get(`http://localhost:8080/GetAllPatients`)
 .then( (response) => {

var resData = response.data;
let data = JSON.stringify(resData);
window.alert("Response recieved from server = " + data);

});
}

I am creating a react app where I have to store patients' data on local Database using SQlite. I want the data from the table to be displayed on to a table. how do I go about it from here. any help will be mush appreatiated.

1 Answers

Create a function that'll generate the table which takes data as parameter. After axios request, I'll delete the table in DOM then create it again using the function.

Related