WIP: Basic Jodel Application

This commit is contained in:
Pete Gerlach
2024-06-02 13:48:26 +02:00
parent d2778cd922
commit f36ea7a34b
11 changed files with 384 additions and 215 deletions

View File

@@ -0,0 +1,27 @@
import React, { useState } from 'react';
const NewPostForm = ({ addPost }) => {
const [text, setText] = useState('');
const handleSubmit = (e) => {
e.preventDefault();
if (text.trim()) {
addPost(text);
setText('');
}
};
return (
<form className="new-post-form" onSubmit={handleSubmit}>
<input
type="text"
value={text}
onChange={(e) => setText(e.target.value)}
placeholder="Schreibe einen neuen Jodel..."
/>
<button type="submit">Posten</button>
</form>
);
};
export default NewPostForm;