Created
June 5, 2022 16:46
-
-
Save Lahirutech/e392d6be101387f172ff62cdb383b4c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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