@refinest/react
v0.2.0
Published
Refinest: React Provider, hooks, slot adapter, base UI translations, RefinestRoutes
Readme
@refinest/react
React bindings for refinest: context providers, the list controller, i18n, capabilities and test-id plumbing.
UI-kit agnostic — it deliberately depends on no @refinest/ui-* package, so any renderer can sit on top. Its native data runtime uses @tanstack/react-query internally.
Install
pnpm add @refinest/react @refinest/coreUsage
import { RefinestProvider, useResourceList } from '@refinest/react';
function Root({ app, children }) {
return <RefinestProvider app={app}>{children}</RefinestProvider>;
}
function MyList() {
const list = useResourceList('company');
return (
<ul>
{list.rows.map((r) => (
<li key={r.id}>{String(r.name)}</li>
))}
</ul>
);
}Main exports
useResourceList— the data-connected list controller: rows, pagination (including the unknown-total contract), filters, search, sorting, columns, selection, saved views, routing hrefs, and the on-demand row count.ResourceListProvider/useResourceListContextexpose it to override slots, so a custom list body is testable against a stub controller with no runtime or Next mocking.useApp/useCurrentResource/useCtx— registry and context access.useAction— invoke a declared action and apply itsActionResult.useCapability/useCapabilityResolver— the deny-wins capability engine gating fields, actions and tabs.useComponent/mergeComponents/ComponentsContext— the component registry behind override slots (list.body.<resource>,list.filters.<resource>,show.banner.<resource>, …).useT/useLocale/I18nContext, plus the built-inen/rulocale bundles — render-time i18n with a live language switch (no reload).TestIdBuilder/TestIdContext— the stable test-id surface shared with@refinest/test-helpers.
License
MIT
