Skip to content

Instantly share code, notes, and snippets.

@artalar
Last active August 6, 2022 00:06
Show Gist options
  • Save artalar/dde51b3860d86929cdedafbc8927a261 to your computer and use it in GitHub Desktop.
Save artalar/dde51b3860d86929cdedafbc8927a261 to your computer and use it in GitHub Desktop.
json-template
<>
<h1 id="login">Login</h1>
<form aria-describedby="login" onSubmit={handleSubmit}>
<input type="email" value={email} onChange={handleChangeEmail} />
<input type="password" value={password} onChange={handleChangePassword} />
<button type="submit">Submit</button>
</form>
</>;
// VS
({
'h1 id="login"': "Login",
'form aria-describedby="login"': {
onSubmit: handleSubmit,
'input type="email"': { value: email, onChange: handleChangeEmail },
'input type="password"': { value: password, onChange: handleChangePassword },
'button type="submit"': "Submit",
},
});
// VS
({
h1: {
id: "login",
children: "Login",
},
form: {
ariaDescribedby: "login",
onSubmit: handleSubmit,
input: {
type: "email",
value: email,
onChange: handleChangeEmail,
},
// error - doubled
input: {
type: "password",
value: password,
onChange: handleChangePassword,
},
button: {
type: "submit",
children: "Submit",
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment