Upload 6.8

This commit is contained in:
Andrew Trieu
2023-06-23 14:20:10 +03:00
parent c5f388c1d1
commit 485c56f8e4
15 changed files with 29695 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import React from 'react'
import { useDispatch } from 'react-redux'
import { addAnecdote } from '../reducers/anecdoteReducer'
const Form = () => {
const dispatch = useDispatch();
const handleNew = (event) => {
event.preventDefault();
const content = event.target.anecdote.value;
event.target.anecdote.value = '';
dispatch(addAnecdote(content));
};
return (
<div>
<h2>Add new anecdote</h2>
<form onSubmit={handleNew}>
<div>
<input name="anecdote" />
</div>
<button type="submit">Submit</button>
</form>
</div>
);
};
export default Form;