useError
Returns the error message if the previous attempt to refresh data failed. Otherwise returns null
Whenever the data object succeeds in refreshing data, this will be reset to null.
Example
import { useData, useError, useLoading } from "@olenbetong/appframe-react";
function MyComponent() {
let data = useData(dsMyDataObject);
let error = useError(dsMyDataObject);
let isLoading = useLoading(dsMyDataObject);
return (
<div>
{error && <Alert severity="error">{error}</Alert>}
{isLoading && <LinearProgress />}
<ul>
{data.map((record) => (
<li key={record.PrimKey}>{record.Title}</li>
))}
</ul>
</div>
);
}API
Last updated
Was this helpful?