Quick Start
React Hooks Usage
Learn how to use qortex-react hooks in your components.
Use the useQuery hook to fetch and subscribe to data in your components.
1. Register a Fetcher
Register a global fetcher (usually in your app entry point):
1. Register a Fetcher
import { registerFetcher } from 'qortex-react';registerFetcher('users', async () => {const res = await fetch('/api/users');return res.json();});
2. Use the Hook
Use useQuery in your components:
2. Use the Hook
import { useQuery } from 'qortex-react';function UserList() {const { data, isLoading, error } = useQuery('users');if (isLoading) return <div>Loading...</div>;if (error) return <div>Error: {error.message}</div>;return (<ul>{data.map(user => (<li key={user.id}>{user.name}</li>))}</ul>);}