useFetchRecord
Works just like useFetchData, except it returns only the first record. This hook is also exported as useFetchSingle.
Example
import { useFetchRecord } from "@olenbetong/appframe-react";
function MyComponent({ personId }) {
let { record, refresh, loading } = useFetchRecord(
dsEmployees,
personId ? `[PersonID] = '${personId}'` : false,
);
return (
<div>
{loading && <LinearProgress />}
{record.FirstName} {record.LastName}
<Button onClick={refresh}>Refresh data</Button>
</div>
);
}API
Last updated
Was this helpful?