How to embed one React-Admin component inside another; multiple Admin components

这一生的挚爱 提交于 2020-04-16 06:07:29

问题


Is this possible? I'd like to use one <Admin to display other imported <Admin components. I'm hoping to do something like this where MyTool is an imported <Admin component:

    <Admin layout={MyLayout}
           dataProvider={myDataProvider}
           customRoutes={[
               <Route
                   exact
                   path="/tools"
                   component={(props) => <MyTool {...props} />}/>

           ]}>
    </Admin>

回答1:


I did try wrapping each <Admin in my own Provider without any success so I'm considering Francois Z. answer to be definitive.

react-admin maintainer here: this has never been a requirement of react-admin, and I've never tested it. It probably won't work, and I personally think it's a bad idea. – François Zaninotto 5 hours ago



来源:https://stackoverflow.com/questions/60218084/how-to-embed-one-react-admin-component-inside-another-multiple-admin-components

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!