useSelect() hook use
hi all
I wounder what is suppose to be the backend section here: https://refine.dev/docs/tutorial/adding-crud-pages/mantine/add-create-page/
I want to make the same input of the category (select item + filtering)
I use node.js express.js and mongoDB for the back end and I want to send products array (data) to the create page to select products
what should I add in the backend and in witch route ? this route : router.route('/').post(createOrder) ?
I will be happy if someone can provide an example for both back + front end or to explain what every section mean
Thank you.
4. Adding Create Page | refine
Create page is the page where you can create the record. In this tutorial, we will create the create page for the products resource.
7 Replies
Hey, I am refine support bot :wave:. I am here to help you with your question. I searched for the answer to your question in the refine documentation and could not find an answer. Please wait for someone from the refine core team or the community to try to help you. 👊
genetic-orange•2y ago
Hello @Deleted User, If I didn't fully understand the question, I apologize in advance. However, I would like to clarify some points.
refine is designed to be compatible with any backend system. You can customize the
dataProvider
based on your specific requirements, or you can use pre-built API providers such as supabase. Here is a helpful resource for understanding the dataProvider
in Refine: https://refine.dev/docs/tutorial/understanding-dataprovider/index/
In the example you mentioned, we are using https://github.com/typicode/json-server as a backend system. We are using useSelect to retrieve categories and create products on the create page.
product endpoint https://api.fake-rest.refine.dev/products
category endpoint: https://api.fake-rest.refine.dev/categories
so, your route should be:
but, as I mentioned earlier refine doesn't have an opinion on the backend. You can create the backend architecture in any way you want. Therefore, we don't have an example of backend implementation.ratty-blushOP•2y ago
the thing is that I want to get data from the backend in the create page but because the create page is a post so I cant send data
how I can do that with useTable ? @alicanerdurmaz
genetic-orange•2y ago
sorry i dont understand :(. what do you mean when you say "create page is a post" ?
<Create>
provides us a layout to display the page. It does not contain any logicratty-blushOP•2y ago
I mean that I cant send data from back end to front end when I open a create page
if refine have the ability to this, how its can be done ? I tried useTable but it did not work
genetic-orange•2y ago
if you you reproduce the issue on codesandbox or any other platform i'm happy to debug. or atleast can you give me your implementation code please
ratty-blushOP•2y ago
ok after checking privately with @alicanerdurmaz
I succussed to send data from backend to front end using useTable () hook with adding the resource that I want
for more details: https://refine.dev/docs/api-reference/core/hooks/useTable/#resource
useTable | refine
useTable allows us to fetch data according to the sorter, filter, and pagination states. Under the hood it uses useList for the fetch. Since it is designed as headless, It expects you to handle the UI.