React Bootstrap:输入字段和ref

时间:2016-03-29 10:26:52

标签: react-bootstrap

如何将react-bootstrap <Input>ref一起使用。

import { Input } from 'react-bootstrap'

<input ref={node => {
      input = node
    }} placeholder="Enter text"/>

当我将上面的代码更改为下面显示的代码时,输​​入字段消失而没有任何错误。如何使用react-bootstrap <Input> field以及ref

,需要一些帮助
<Input type="text" ref={node => {
      input = node
    }} placeholder="Enter text"/>

1 个答案:

答案 0 :(得分:0)

存在称为输入包装器的东西,它没有任何type。可以轻松完成。为此打扰StackOverflow道歉。

<Input wrapperClassName="wrapper">
    <input className="form-control" ref={node => {
      input = node
    }} placeholder="Enter text"/>
</Input>