http://plnkr.co/edit/2aIgMzUx7XgZe9EA6upB?p=preview&open=app%2Fapp.component.ts
http://plnkr.co/edit/EIsS2pFsDwATaq1Ibxvb?p=preview
http://plnkr.co/edit/hCCEtt1SVohWN80s0ej8?p=preview&open=app%2Fapp.component.ts
| // Reusable fetching hook | |
| const useRequest = (requestFunc) => { | |
| const [data, setData] = useState({}) | |
| const [loading, setLoading] = useState(false) | |
| const [error, setError] = useState(null) | |
| const fetch = async () => { | |
| setLoading(true) | |
| try { | |
| const data = await requestFunc() |
| .container { | |
| height: 500px; | |
| border: 2px solid grey; | |
| position:relative; | |
| } | |
| .split { | |
| display: flex; | |
| height: 100%; | |
| border: 1px solid black; |