那里有一个名为farsitype.js的脚本,我想将它与react-select组件一起使用,但是无法直接访问内部输入字段以为其添加属性。有什么方法可以在react-select中向内部输入字段添加属性?
如果您正在谈论此react-select库。您可以像这样自定义Input
组件:
import React from 'react';
import Select, { components } from 'react-select';
import { typeOptions } from '../data';
const Input = props => {
// add attribues to the component below
return <components.Input {...props} />;
};
export default () => (
<Select
components={{ Input }}
options={typeOptions}
/>
);