diff options
| author | Melonai <einebeere@gmail.com> | 2020-05-20 21:16:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-20 21:16:34 +0200 |
| commit | e9f542ddc8b8230418b1e6fc1656677453ea5a10 (patch) | |
| tree | efe84fba111c308370a89fba61dd9e8548a01085 /client/src/App.js | |
| parent | a00a8a867cae381982c7b8b77f07836ab4a504ed (diff) | |
| parent | 58abd266b0b5ec37c5d7beea37abc2babd7d504a (diff) | |
| download | shorest-e9f542ddc8b8230418b1e6fc1656677453ea5a10.tar.zst shorest-e9f542ddc8b8230418b1e6fc1656677453ea5a10.zip | |
Merge pull request #1 from Melonai/react-port 0.2.0
React port
Diffstat (limited to 'client/src/App.js')
| -rw-r--r-- | client/src/App.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/client/src/App.js b/client/src/App.js new file mode 100644 index 0000000..135a037 --- /dev/null +++ b/client/src/App.js @@ -0,0 +1,25 @@ +import React, {useState} from 'react'; +import './App.css'; +import Title from './Components/Title'; +import Form from './Components/Form'; +import ResponseContainer from './Components/ResponseContainer'; +import shortid from 'shortid'; + +function App() { + const [requests, setRequests] = useState([]); + + const addRequest = (newRequest) => { + const newRequests = [{url: newRequest, key: shortid.generate()}, ...requests]; + setRequests(newRequests.slice(0, 2)); + } + + return ( + <div> + <Title/> + <Form addRequest={addRequest}/> + <ResponseContainer requests={requests}/> + </div> + ); +} + +export default App; |
