react-admin
- Version 5.5.2
- Published
- 3.09 MB
- 11 dependencies
- MIT license
Install
npm i react-admin
yarn add react-admin
pnpm add react-admin
Overview
A frontend Framework for building admin applications on top of REST services, using ES6, React and Material UI
Index
Variables
variable defaultI18nProvider
const defaultI18nProvider: any;
Functions
function Admin
Admin: (props: AdminProps) => React.JSX.Element;
Main admin component, entry point to the application.
Initializes the various contexts (auth, data, i18n, router) and defines the main routes.
Expects a list of resources as children, or a function returning a list of resources based on the permissions.
Example 1
// static list of resources
import { Admin, Resource, ListGuesser, useDataProvider, } from 'react-admin';
const App = () => ( <Admin dataProvider={myDataProvider}> <Resource name="posts" list={ListGuesser} /> );
// dynamic list of resources based on permissions
import { Admin, Resource, ListGuesser, useDataProvider, } from 'react-admin';
const App = () => ( <Admin dataProvider={myDataProvider}> {permissions => [ <Resource name="posts" key="posts" list={ListGuesser} />, ]} );
// If you have to build a dynamic list of resources using a side effect, // you can't use . But as it delegates to sub components, // it's relatively straightforward to replace it:
import * as React from 'react'; import { useEffect, useState } from 'react'; import { AdminContext, AdminUI, defaultI18nProvider, localStorageStore, Resource, ListGuesser, useDataProvider, } from 'react-admin';
const store = localStorageStore();
const App = () => ( <AdminContext dataProvider={myDataProvider} i18nProvider={defaultI18nProvider} store={store}> );
const Resources = () => { const [resources, setResources] = useState([]); const dataProvider = useDataProvider(); useEffect(() => { dataProvider.introspect().then(r => setResources(r)); }, []);
return ( {resources.map(resource => ( <Resource name={resource.name} key={resource.key} list={ListGuesser} /> ))} ); };
Interfaces
interface AdminProps
interface AdminProps extends AdminContextProps, AdminUIProps {}
Package Files (3)
Dependencies (11)
Dev Dependencies (6)
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-admin
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-admin)
- HTML<a href="https://www.jsdocs.io/package/react-admin"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2966 ms. - Missing or incorrect documentation? Open an issue for this package.