diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b58b603 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5a53714 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/myfirstapp.iml b/.idea/myfirstapp.iml new file mode 100644 index 0000000..0c8867d --- /dev/null +++ b/.idea/myfirstapp.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/App.js b/src/App.js index 65b81b4..b2ddd70 100644 --- a/src/App.js +++ b/src/App.js @@ -1,13 +1,39 @@ import './App.css'; -import Message from './Message'; +import React, {useEffect, useState} from "react"; function App() { - const myText = "Tasks from Lesson 1 complete"; + const[messageList, setMessageList] = useState([]); + const[author, setAuthor] = useState(""); + const[message, setMessage] = useState(""); + let idCounter = messageList.length; + + useEffect(() => { + if(messageList.length > 0) + setTimeout(() => alert("Message send"), 1500) + }, [messageList]); + return ( -
- +
+ <> + setAuthor(e.target.value)}/> +
+ setMessage(e.target.value)}/> +
+ + + {messageList.map((item) => +

Author: {item.author}
Say: {item.text}

+ )} + +
); } -export default App; \ No newline at end of file +export default App;