graceful-blue
graceful-blue2y ago

AntdInferencer not working even adjusting the new API

return <AntdInferencer resource="blogs" action="list" />;
No description
11 Replies
kapa.ai
kapa.ai2y ago
Hi @pkalib. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information extracts provided, you can use the <AntdInferencer> component to generate a sample list view for your resources. However, the example provided in the extracts does not include the resource and action props. Here's the example from the extracts:
import { Refine } from "@refinedev/core";
import { Layout } from "@refinedev/antd";
import routerProvider from "@refinedev/react-router-v6";
import dataProvider from "@refinedev/simple-rest";

import { BrowserRouter, Routes, Route, Outlet } from "react-router-dom";

import { AntdInferencer } from "@refinedev/inferencer/antd";

const API_URL = "https://api.fake-rest.refine.dev";

const App: React.FC = () => {
return (
<BrowserRouter>
<Refine
routerProvider={routerProvider}
dataProvider={dataProvider(API_URL)}
resources={[
{
name: "samples",
list: "/samples",
},
]}
>
<Routes>
<Route
element={
<Layout>
<Outlet />
</Layout>
}
>
<Route path="/samples" element={<AntdInferencer />} />
</Route>
</Routes>
</Refine>
</BrowserRouter>
);
};
import { Refine } from "@refinedev/core";
import { Layout } from "@refinedev/antd";
import routerProvider from "@refinedev/react-router-v6";
import dataProvider from "@refinedev/simple-rest";

import { BrowserRouter, Routes, Route, Outlet } from "react-router-dom";

import { AntdInferencer } from "@refinedev/inferencer/antd";

const API_URL = "https://api.fake-rest.refine.dev";

const App: React.FC = () => {
return (
<BrowserRouter>
<Refine
routerProvider={routerProvider}
dataProvider={dataProvider(API_URL)}
resources={[
{
name: "samples",
list: "/samples",
},
]}
>
<Routes>
<Route
element={
<Layout>
<Outlet />
</Layout>
}
>
<Route path="/samples" element={<AntdInferencer />} />
</Route>
</Routes>
</Refine>
</BrowserRouter>
);
};
To use the <AntdInferencer> component with the resource and action props, you can modify the example like this:
<Route path="/blogs" element={<AntdInferencer resource="blogs" action="list" />} />
<Route path="/blogs" element={<AntdInferencer resource="blogs" action="list" />} />
Please note that this modification is not directly from the provided extracts, but it's based on the information available in the extracts. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2y ago
<@329809837338656770> kapa.ai is still learning and improving, please let us how it did by reacting below
graceful-blue
graceful-blueOP2y ago
um using nextjs
correct-apricot
correct-apricot2y ago
Hey @pkalib, Did you define your resources in <Refine> component?
graceful-blue
graceful-blueOP2y ago
yes
graceful-blue
graceful-blueOP2y ago
No description
correct-apricot
correct-apricot2y ago
Can you explain in details such as console errors?
graceful-blue
graceful-blueOP2y ago
there is no error actualy it just dont render
correct-apricot
correct-apricot2y ago
It's interesting can you create a codesandbox environment to investigate it? Btw, refine.new is using the Inferencer to create projects and they work as expected.
other-emerald
other-emerald2y ago
Hey @pkalib any chance to try out the other actions such as show? Are you trying with a new project or migrating an existing one to v4?
graceful-blue
graceful-blueOP2y ago
Sure I will the project was created via cli then I updated it since it prompted new changes