Skip to content

Commit

Permalink
* Updated button action
Browse files Browse the repository at this point in the history
  • Loading branch information
andresgd7 committed May 2, 2024
1 parent 65e03fc commit a75d2fb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React, { useState } from 'react';

export default function App() {
const [data, setData] = useState(null);
const [mostrarMensaje, setMostrarMensaje] = useState(false);

const obtenerData = async () => {
setData("Api en construcción");
setMostrarMensaje(true);
};

return (
Expand All @@ -17,9 +19,11 @@ export default function App() {
Obtener data
</button>
</div>
<div style={{ marginTop: '20px', fontSize: '18px' }}>
{data ? data : "Api en construcción"}
</div>
{mostrarMensaje && (
<div style={{ marginTop: '20px', fontSize: '18px' }}>
{data ? data : "Api en construcción"}
</div>
)}
</div>
);
}

0 comments on commit a75d2fb

Please sign in to comment.