Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/fastro/pages/app.tsx

The Web Framework for Full Stack Apps
Go to Latest
File
import React, { useState } from "https://esm.sh/react@18.2.0?dev";
type D = { time: string };
const App = (props: { data: string }) => { const data: D = { time: "___" }; const [d, setD] = useState(data);
const handleClick = async () => { const res = await fetch("/api"); const jsonData = await res.json(); setD(jsonData); };
return ( <div className="row align-items-center" style={{ height: "100vh" }}> <div className="mx-auto col-3"> <div className="container"> <h1>Hellooooooo {props.data}</h1> <button type="button" className="btn btn-primary" onClick={handleClick} > Hit API </button> <pre className="mt-2">Response {JSON.stringify(d)}</pre> </div> </div> </div> );};
export default App;