Last active
July 30, 2021 03:15
-
-
Save jasonleehodges/7d0ce0675c3071bc83e96de2dc91cfe9 to your computer and use it in GitHub Desktop.
Entanglement Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC } from 'react'; | |
import styles from './createUser.module.css'; | |
export interface Contact { | |
name: string, | |
email: string, | |
phoneNumber: string, | |
} | |
interface Props { | |
user: Contact; | |
setUser: (property: keyof Contact) => (e: React.ChangeEvent<HTMLInputElement>) => void; | |
} | |
export const CreateUser: FC<Props> = ({ user, setUser }) => ( | |
<form className={styles.create__user}> | |
<label>Name</label> | |
<input value={user.name} onChange={setUser('name')} /> | |
<label>Email</label> | |
<input value={user.email} onChange={setUser('email')} /> | |
<label>Phone Number</label> | |
<input value={user.phoneNumber} onChange={setUser('phoneNumber')} /> | |
</form> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment