nursing-limeN
Refine2y ago
18 replies
nursing-lime

Put intial values:

I want to enter the data from the datbase |

import React from 'react';
import { IResourceComponentsProps } from '@refinedev/core';
import { Edit, useForm, useSelect } from '@refinedev/antd';
import { Form, Select } from 'antd';

export const ProductEdit: React.FC<IResourceComponentsProps> = () => {
const { formProps, saveButtonProps, queryResult } = useForm();

const productData = queryResult?.data?.data;

const { selectProps: typeSelectProps } = useSelect({
resource: 'type',
optionLabel: 'name',
optionValue: 'name',
});

const { selectProps: tierSelectProps } = useSelect({
resource: 'tier',
optionLabel: 'name',
optionValue: 'name',
});

const { selectProps: segmentSelectProps } = useSelect({
resource: 'segment',
optionLabel: 'name',
optionValue: 'name',
});

return (
<Edit saveButtonProps={saveButtonProps}>
<Form {...formProps} layout="vertical">
<Form.Item
label="Type"
name={['type', 'name']}
rules={[
{
required: false,
},
]}
>
as option value
Was this page helpful?