Last active
December 2, 2020 02:47
-
-
Save adevesa/a5d472d7c5af932d165b1faeff9599b4 to your computer and use it in GitHub Desktop.
Medium - Como desarrollar con Create React App y Laravel
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 from 'react'; | |
import './App.css'; | |
function App() { | |
const [textoDePrueba, setTextoDePrueba] = React.useState('Aquí no pasó nada') | |
React.useEffect(() => prueba(), []); | |
const prueba = () => fetch('/hola') | |
.then(result => result.json()) | |
.then((json) => setTextoDePrueba(json.prueba)); | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<p> | |
{textoDePrueba} | |
</p> | |
</header> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment