mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
inline lint
This commit is contained in:
parent
da549da826
commit
ea43859a52
1 changed files with 1 additions and 4 deletions
|
|
@ -3,10 +3,7 @@ import { useEffect, useState } from 'react';
|
|||
export const useApiData = <T extends {}>(url: string) => {
|
||||
const [data, setData] = useState<T>();
|
||||
useEffect(() => {
|
||||
const fetchData = async () =>
|
||||
(await fetch(url))
|
||||
.json()
|
||||
.then(r => setData(r));
|
||||
const fetchData = async () => (await fetch(url)).json().then(r => setData(r));
|
||||
fetchData();
|
||||
}, [url]);
|
||||
return data;
|
||||
|
|
|
|||
Loading…
Reference in a new issue