Semantic-ui-react: Getting the value from <Input/>

Created on 22 Oct 2016  路  3Comments  路  Source: Semantic-Org/Semantic-UI-React

With an HTML input I would just do this.refs.whatever.value but what do I do with a Semantic <Input/>?

question

Most helpful comment

Using a ref is accessing the DOM directly and not preferred. The React way to get the value from an input is using the onChange callback and getting the value from the event:

<input onChange={e => console.log(e.target.value)} />

You can get the value for an <Input /> just as you can in React:

<Input onChange={e => console.log(e.target.value)} />

All 3 comments

Using a ref is accessing the DOM directly and not preferred. The React way to get the value from an input is using the onChange callback and getting the value from the event:

<input onChange={e => console.log(e.target.value)} />

You can get the value for an <Input /> just as you can in React:

<Input onChange={e => console.log(e.target.value)} />

I think its changed now to:

onChange={(e,data)=>{
 console.log(data.value)
        }

This issue was closed in 2016, necroposting is bad 馃憥

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlvMF1 picture AlvMF1  路  3Comments

levithomason picture levithomason  路  3Comments

KevinGorjan picture KevinGorjan  路  3Comments

keeslinp picture keeslinp  路  3Comments

GautierT picture GautierT  路  3Comments