UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

19 lines 572 B
import * as React from 'react'; import { useRecordContext } from "./useRecordContext.js"; /** * Render prop version of useRecordContext * * @example * const BookShow = () => ( * <Show> * <SimpleShowLayout> * <WithRecord render={record => <span>{record.title}</span>} /> * </SimpleShowLayout> * </Show> * ); */ export const WithRecord = ({ render, empty = null, }) => { const record = useRecordContext(); return record ? React.createElement(React.Fragment, null, render(record)) : empty; }; //# sourceMappingURL=WithRecord.js.map