cloud_bbb/ts/Manager/NewRoomForm.tsx

31 lines
680 B
TypeScript
Raw Normal View History

2020-04-26 11:36:41 +02:00
import React, {useState} from 'react';
type Props = {
2020-04-26 22:41:06 +02:00
addRoom: (name: string) => void;
2020-04-26 11:36:41 +02:00
}
const NewRoomForm: React.FC<Props> = (props) => {
const [name, setName] = useState('');
function addRoom(ev: React.FormEvent) {
ev.preventDefault();
props.addRoom(name);
setName('');
}
return (
<form action="#" onSubmit={addRoom}>
<input
className="newgroup-name"
value={name}
placeholder="Room name"
onChange={(event) => {setName(event.target.value)}} />
<input type="submit" value="Create" />
</form>
)
}
export default NewRoomForm;