Grokking React Native
Vote

0% completed

​

Introduction to React Query

Compare two ways of showing the same list of users on one screen. The first way uses useEffect and useState, as the Data Fetching chapter taught, and each component that needs users runs this code:

function UserCount() { const [users, setUsers] = useState([]); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { fetch('https://jsonplaceholder.typicode.com/users') .then((response) => response.json()) .then(setUsers) .catch(setError) .finally(() => setIsLoading(false)); }, []);

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content