Skip to content

Instantly share code, notes, and snippets.

@Lahirutech
Created June 5, 2022 16:46
Show Gist options
  • Save Lahirutech/e392d6be101387f172ff62cdb383b4c0 to your computer and use it in GitHub Desktop.
Save Lahirutech/e392d6be101387f172ff62cdb383b4c0 to your computer and use it in GitHub Desktop.
import React, {useEffect, useState} from 'react'
import axios from 'axios'
import logo from './logo.svg';
import './App.css';
function App() {
const [message, setmessage] = useState("")
const getData = async () => {
const res = await axios.get('/profile')
setmessage(res.data.message)
}
useEffect(() => {
getData()
}, [])
return (
<div className="App">
<p>Our message is {message}</p>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment