Front-end/React.js
react-admin 메모 : Admin
byolee
2020. 3. 2. 17:56
https://marmelab.com/react-admin/Admin.html
React-admin - Admin and Resource Components
The Component The component creates an application with its own state, routing, and controller logic. requires only a dataProvider prop, and at least one child to work: // in src/App.js import React from 'react'; import { Admin, Resource } from 'react-admi
marmelab.com
const App = () => (
<Admin dataProvider={simpleRestProvider('http://path.to.my.api')}>
<Resource name="posts" list={PostList} />
</Admin>
);
props
- dataProvider
- title
- dashboard
- catchAll
- menu
- theme
- layout
- customReducers
- customSagas
- customRoutes
- authProvider
- loginPage
- logoutButton
- initialState
- history
- Internationalization
- Declaring resources at runtime
- Using react-admin without <Admin> and <Resource>
React-admin - Admin and Resource Components
The Component The component creates an application with its own state, routing, and controller logic. requires only a dataProvider prop, and at least one child to work: // in src/App.js import React from 'react'; import { Admin, Resource } from 'react-admi
marmelab.com
data provider : required prop
- object여야 하고 다음과 같은 메소드를 리턴해야 함.
- 커스텀 http 헤더와 auth 부분을 추가하기 좋은 부분
const dataProvider = {
getList: (resource, params) => Promise,
getOne: (resource, params) => Promise,
getMany: (resource, params) => Promise,
getManyReference: (resource, params) => Promise,
create: (resource, params) => Promise,
update: (resource, params) => Promise,
updateMany: (resource, params) => Promise,
delete: (resource, params) => Promise,
deleteMany: (resource, params) => Promise,
}
title
- 에러페이지의 헤더
dashboard
- object여야 하고 다음과 같은 메소드를 리턴해야 함.