import { useState } from 'react' function App() { const [inputText, setInputText] = useState("Critical satellite telemetry data sequence initialized.") const [corruptedText, setCorruptedText] = useState("") const [decodedText, setDecodedText] = useState("") const [loading, setLoading] = useState(false) const handleTransmit = async () => { setLoading(true) setCorruptedText("") setDecodedText("") try { // 1. Send your custom text to the backend const response = await fetch('/api/transmit', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: inputText }) }) const data = await response.json() // 2. Display the results setCorruptedText(data.corrupted) setDecodedText(data.decoded) } catch (error) { setDecodedText("Error connecting to the server.") } setLoading(false) } return (
{corruptedText}
{decodedText}