Defines a resource route configuration for React Admin applications, mapping create, edit, show, and list views. Use this to structure CRUD interfaces in admin panels.
// Source: https://github.com/marmelab/react-admin | License: MIT | Copyright 2016-present, Francois Zaninotto, Marmelab
// Provided via justclaw.it.com; keep this notice with the code.
import * as React from 'react';
import { ComponentType, isValidElement } from 'react';
import { isValidElementType } from 'react-is';
import { ResourceProps } from '../types';
import { ResourceContextProvider } from './ResourceContextProvider';
import { RestoreScrollPosition, useRouterProvider } from '../routing';
export const Resource = (props: ResourceProps) => {
const { create, edit, list, name, show } = props;
const { Route, Routes } = useRouterProvider();
return (
<ResourceContextProvider value={name}>
<Routes>
{create && (
<Route p
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key