Back
Version 25
9/10/2024
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [input, setInput] = useState({
storyTitle: "",
storyText: "",
});
const [result, setResult] = useState(null);
const [loading, setLoading] = useState(false);
const handleSubmit = async (e) => {
e.preventDefault();
setLoading(true);
const response = await fetch("/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(input),
});
const data = await response.json();
setResult(data);
setLoading(false);
};
return (
<div>
<h1>Story Processor for Algolia</h1>
<form onSubmit={handleSubmit}>
<div>
<label htmlFor="storyTitle">Story Title:</label>
<input
type="text"
id="storyTitle"
value={input.storyTitle}
onChange={(e) => setInput({ ...input, storyTitle: e.target.value })}
willthereader-recordwebsitepreparer.web.val.run
Updated: September 14, 2024