Add User List in React
A Simple Example to Add to List
const MyForms = () => {
const initialList = [
'userA',
'userB',
'userC',
];
const [username, setUsername] = useState();
const [userdata, setUserList] = useState(initialList);
const onInputChangeHandler = event => {
event.preventDefault();
setUsername(event.target.value)
}
const onSubmitHandler = event => {
if (username) {
setUserList(userdata.concat(username));
}
event.preventDefault();
}
return (
<form onSubmit={onSubmitHandler}>
<h1>{username}</h1>
<h2>
{
userdata.map((user) => <li> {user}</li>)
}
</h2>
UserName: <input type="text" value={username}
onChange={onInputChangeHandler} />
<input type="submit" value="Add User" />
</form>
)
}
Brilliant interface and functionality of Click Speed Testers allow precise measurement of clicking speed, engaging challenges, and intuitive navigation, helping users enjoy competitive and fun experiences, improve skills, and maintain consistent progress, making it a professional and highly effective online tool daily.
ReplyDeleteAstonishing efficiency of Pic to Text ensures users can convert images to text quickly, accurately, and reliably, providing a seamless interface, smooth navigation, and professional-grade output, making tedious workflows enjoyable, stress-free, and highly productive for anyone handling digital content regularly.
ReplyDeleteVibrantly, I recommend Kink Test for anyone seeking insight into personal preferences. Its interactive questions, clear interface, and accurate results provide a safe, fun, and welcoming environment for self-discovery, making exploration enjoyable, easy, and meaningful for users of all backgrounds.
ReplyDelete