Coding By Yakub
703 subscribers
273 photos
97 files
24 links
This channel for online classes videos for java , jdbc, hibernate, spring and spring boot and react js. With handson
Download Telegram
import axios from "axios";
import {useRef,useState} from "react";
const PostExp1=()=>{
const [res,setRes]=useState({});
const ref1=useRef(null);
const ref2=useRef(null);
const ref3=useRef(null);

const post_data=()=>{
postEx();
}
const postEx=async ()=>{
const res=await axios.post("http://localhost:9000/save",{"name":ref1.current.value,
"current_reading":ref2.current.value,
"previous_reading":ref3.current.value});
const {data}=res;
setRes(data);
}
return(
<>
Consumer Name: <input type="text" ref={ref1}></input> <br></br><br></br>
Current_Reading: <input type="text" ref={ref2}></input> <br></br><br></br>
Previous_Reading: <input type="text" ref={ref3}></input> <br></br><br></br>
<button onClick={post_data}>Post</button>
<p>{JSON.stringify(res)}</p>
</>
)
}
export default PostExp1;
import axios from "axios";
import { useRef,useState } from "react";

const [res,setRes] = useState({});
const ref1 = useRef(null);
const ref2 = useRef(null);
const ref3 = useRef(null);
const ref4 = useRef(null);
const update_data=()=>{
updateEx();
}
const updateEx = async ()=>{
const res = await axios.put(http://localhost:9000/update/${ref1.current.value},{
"name":ref2.current.value,
"current_reading":ref3.current.value,
"previous_reading":ref4.current.value,});
const {data} = res;
setRes(data);
}
return(<>
<div style={{textAlign:"center", border:"double", borderColor:"red", marginLeft:400, marginRight:400, marginTop:50}}>
Consumer Id : <input type="text" ref={ref1}></input><br></br><br></br>
Consumer Name : <input type="text" ref={ref2}></input><br></br><br></br>
Current Reading : <input type="text" ref={ref3}></input><br></br><br></br>
Previous Reading : <input type="text" ref={ref4}></input><br></br><br></br>
<button onClick={update_data}>update</button>
<p>{JSON.stringify(res)}</p>
</div>
</>)



}
export default UpdateEmployee;
👍1
Gai Java folks if any one want join spring boot class . Through online. Please join on 9pm to 10 pm . Fee is 7000
Spring boot rest+micro service+with tools
content://com.whatsapp.w4b.provider.media/item/48007368-2978-40f7-a05d-6de5b1c7504b
content://media/external_primary/downloads/1000038734
Hai
🙏3
👍6