Reactjs react引导如何使用自定义表单控件组件

Reactjs react引导如何使用自定义表单控件组件,reactjs,react-bootstrap,Reactjs,React Bootstrap,我需要在表单中添加select输入,但是选项太多了,所以默认的方式看起来非常糟糕( 看起来是这样的: 我可能做得不好,但我不知道如何用另一种方式来做( 他们有一个道具“as”。参见埃克斯姆勒·贝娄 export default function Input(props) { const CustomFormControl = React.forwardRef(({ children, onChange}, ref) => ( <> <p>I

我需要在表单中添加select输入,但是选项太多了,所以默认的方式看起来非常糟糕(

看起来是这样的:

我可能做得不好,但我不知道如何用另一种方式来做(

他们有一个道具“as”。参见埃克斯姆勒·贝娄

export default function Input(props) { 

 const CustomFormControl = React.forwardRef(({ children, onChange}, ref) => (
    <>
     <p>Insert your elements for yout form</p>
     <p>{props.test}</p>
    </>
  ));

return (
    <>
        <Form.Control
        as = {CustomFormControl}
        test = {"hellow world"}
        /** and here u can inser the props you need **/
        />
    </>

}
导出默认函数输入(props){
const CustomFormControl=React.forwardRef(({children,onChange},ref)=>(
为您的表单插入元素

{props.test}

)); 返回( }

他们有一个道具“as”。参见埃克斯姆勒·贝娄

export default function Input(props) { 

 const CustomFormControl = React.forwardRef(({ children, onChange}, ref) => (
    <>
     <p>Insert your elements for yout form</p>
     <p>{props.test}</p>
    </>
  ));

return (
    <>
        <Form.Control
        as = {CustomFormControl}
        test = {"hellow world"}
        /** and here u can inser the props you need **/
        />
    </>

}
导出默认函数输入(props){
const CustomFormControl=React.forwardRef(({children,onChange},ref)=>(
为您的表单插入元素

{props.test}

)); 返回( }
export default function Input(props) { 

 const CustomFormControl = React.forwardRef(({ children, onChange}, ref) => (
    <>
     <p>Insert your elements for yout form</p>
     <p>{props.test}</p>
    </>
  ));

return (
    <>
        <Form.Control
        as = {CustomFormControl}
        test = {"hellow world"}
        /** and here u can inser the props you need **/
        />
    </>

}