$crim
Explore posts from serversRRefine
•Created by exotic-emerald on 3/3/2024 in #ask-any-question
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
19 replies