How to get an input value using “refs” in react-bootstrap form?

前端 未结 7 742
小蘑菇
小蘑菇 2021-02-05 04:01

I\'m trying to create a form that appears in modal. So when user input a value, that value is stored in local storage. Here\'s a picture that help\'s you to understand what I me

7条回答
  •  北海茫月
    2021-02-05 04:55

    I just made this issue. My code:

     {this.input = ref}}
        defaultValue={title}/>
    
    

    And then you can get the value from in some handler like this:

    console.log(this.input.value);
    

    Details can be found in my repo: https://github.com/kerf007/recipebook

提交回复
热议问题