React Mental Models: Working with Input
learnreact.design
learnreact.design
If you're looking for libs to help abstract working with more complex forms, Formik [3] and React Final Form [4] are probably your two best options.
[0] https://goshakkk.name/on-forms-react/
[1] https://goshakkk.name/controlled-vs-uncontrolled-inputs-reac...
[2] https://goshakkk.name/the-missing-forms-handbook-of-react/
function App() {
const [draft, setDraft] = React.useState("")
const handleClick = () => setDraft("smiley")
return (
<div>
<input type="text" value={draft} />
<button onClick={handleClick}>smiley</button>
</div>
)
}
It's actually what most people do.You could also argue that any template is syntactic sugar for whatever is happening behind the hoods.
Also if you do not treat it as a template, I'm concerned you will do something very hacky, unreadable and unmaintainable.