【问题标题】:ResourceContextProvider doesn't work in react-adminResourceContextProvider 在 react-admin 中不起作用
【发布时间】:2022-06-20 19:25:06
【问题描述】:

enter image description here

AdminPanel.tsx

 <Resource
        options={{ label: 'Transactions' }}
        icon={WorkIcon}
        name={path}
        list={TransactionsList}
      />

TransactionsList.tsx

const PostList = () => (
<ResourceContextProvider value={path}>
  
  <List syncWithLocation {...props}>
   <Datagrid  >
  <FullNameUserField label="User" source="userFirstName" />
    <TextField label="Goal Type" source="savingGoalType" />
    <TextField label="Goal name" source="savingGoalName" />
   
    <TextField label="Target Amount" source="targetAmount" />
    <SavingGoalCreationDateField label="Goal creation date" source="savingGoalCreationDate" />
    <TextField label="Strategy Name" source="strategyName" />
    <SavingGoalCreationDateField label="Target Date" source="targetDate" />
    <TextField label="Status" source="savingGoalStatus" />
  </Datagrid>
  </List>
</ResourceContextProvider>)



 <Tab label="comments" path="comments">
               <PostLisst />
 </Tab>

enter image description here

我无法显示请求的结果,为什么?

【问题讨论】:

  • 这里没有足够的信息来提供答案,请在您实际尝试访问上下文的位置显示代码。还有什么是路径,很多信息都缺乏。

标签: javascript reactjs react-admin


【解决方案1】:

const PostList = () => (...我没有看到需要传递的props ---> const PostList = (props) =>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-01
    • 1970-01-01
    • 2019-08-30
    • 1970-01-01
    • 2020-01-26
    • 1970-01-01
    • 1970-01-01
    • 2014-10-21
    相关资源
    最近更新 更多