Skip to content

Instantly share code, notes, and snippets.

@adevesa
Last active December 2, 2020 02:47
Show Gist options
  • Save adevesa/a5d472d7c5af932d165b1faeff9599b4 to your computer and use it in GitHub Desktop.
Save adevesa/a5d472d7c5af932d165b1faeff9599b4 to your computer and use it in GitHub Desktop.
Medium - Como desarrollar con Create React App y Laravel
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