useCurrentRow
Hook used to return the currently selected record in a data object
Returns the current record, including any unsaved changes.
If a filter is set in the options object, data will be loaded with said filter, just like in useData.
Example
Use current row without loading data:
import { useCurrentRow } from "@olenbetong/appframe-data";
function MyComponent() {
let record = useCurrentRow(dsMyDataObject);
return (
<p>
{record.ID}: {record.Title}
</p>
);
}Ensure the correct data is loaded before using the current row:
import { useCurrentRow } from "@olenbetong/appframe-data";
function MyComponent({ id }: { id: number }) {
let record = useCurrentRow(dsMyDataObject, { filter: `[ID] = ${id}` });
return (
<p>
{record.ID}: {record.Title}
</p>
);
}API
Last updated
Was this helpful?