useData

Returns any data currently stored in the data object. If the data object is dynamic loading, the data for the current page is returned.

An optional second options parameter is available. If you set the includeDirty property to true, any unsaved data on the current record will be included in the data. The options also accept the same properties as the useFilter hook. If a filter is provided, the hook will apply the filter and load data accordingly. If the filter option is omitted, no filter will be applied and the data object will not refresh automatically.

Example

import { useData } from "@olenbetong/appframe-react";

function ListData({ id }) {
  let data = useData(dsMyDataObject, { filter: id ? `[ID] = ${id}` : false });

  return (
    <ul>
      {data.map((record) => (
        <li key={record.PrimKey}>{record.Title}</li>
      ))}
    </ul>
  );
}

API

Last updated

Was this helpful?