reactjs 我在使用Form.File react-bootstrap组件时遇到了一些问题

kqqjbcuj  于 2023-04-11  发布在  React
关注(0)|答案(1)|浏览(156)

我像这样导入组件:

import { Form } from 'react-bootstrap'
<Form.File
   id='image-file'
   label='Choose File'
   custom
   onChange={uploadFileHandler}
   ></Form.File>

我得到以下错误:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

oxiaedzo

oxiaedzo1#

没有名为Form.File的组件。您必须使用Type=“file”的Form.Control:
https://react-bootstrap.github.io/forms/form-control/#file-input

相关问题