From 47976dbe89fba139ea0737e1795d0c898c6a3eab Mon Sep 17 00:00:00 2001 From: rosh Date: Wed, 8 Jul 2020 12:35:55 +0530 Subject: [PATCH] array of strings --- src/App.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/App.js b/src/App.js index 8a08ac5..3275454 100644 --- a/src/App.js +++ b/src/App.js @@ -28,19 +28,21 @@ function App() { ); }*/ - const [fName, setfName] = useState(''); +const [input, setInput] = useState(""); +const [list, setList] = useState([]); - const submitValue = () => { - const frmdetails = { - 'First Name' : fName - } - console.log(frmdetails); - }; +const addToList = e => { + setList([ ...list, input ]); + setInput(""); +}; return(
- setfName(e.target.value)} /> - -
+ setInput(e.target.value)} /> + + + ); }