ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
22 lines • 748 B
JavaScript
import * as React from 'react';
import { forwardRef } from 'react';
import { useRouterProvider } from "./RouterProviderContext.js";
/**
* Base Link component for use with react-admin's routing.
* This is a router-agnostic wrapper that uses the configured router provider.
*
* For most use cases, prefer the styled `Link` component from `ra-ui-materialui`.
*
* @example
* import { LinkBase } from 'ra-core';
*
* const MyComponent = () => (
* <LinkBase to="/posts/1">Post 1</LinkBase>
* );
*/
export const LinkBase = forwardRef((props, ref) => {
const provider = useRouterProvider();
return React.createElement(provider.Link, { ref: ref, ...props });
});
LinkBase.displayName = 'LinkBase';
//# sourceMappingURL=LinkBase.js.map