From 9d9e4dd694d9821e23b997b4e749e7a3b2e2e85d Mon Sep 17 00:00:00 2001 From: rosh Date: Tue, 14 Jul 2020 13:57:54 +0530 Subject: [PATCH] completed changes --- src/App.js | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/src/App.js b/src/App.js index 3275454..164a2f1 100644 --- a/src/App.js +++ b/src/App.js @@ -4,7 +4,13 @@ import './App.css'; import produce from 'immer'; import { useState } from 'react'; -function App() { + + + + + + + /*const Notes = props => props.data.map(note =>
{note.text}
); const initialData = [{ text: 'Hey' }, { text: 'There' }]; const [data, setData] = useState(initialData); @@ -27,23 +33,47 @@ function App() { ); }*/ +function App() { + const [input, setInput] = useState(""); + const [list, setList] = useState([]); + const [visible, setVisible] = useState(null); + const addToList = e => { + setList([ ...list, input ]); + setInput(""); + }; + + const deleteList = id => e => { + setList(list.filter((item, index) => index !== id)); + }; + + function hideMe(){ + setVisible(false); + } + + let style = { textDecoration: "none" }; + if (!visible) style.textDecoration = "line-through"; -const [input, setInput] = useState(""); -const [list, setList] = useState([]); -const addToList = e => { - setList([ ...list, input ]); - setInput(""); -}; return( +
setInput(e.target.value)} /> + +
); } + + + export default App;