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

ryanpcmcquen picture ryanpcmcquen  路  3Comments

nix1 picture nix1  路  3Comments

saikrishnadeep picture saikrishnadeep  路  3Comments

wyemun picture wyemun  路  3Comments

AlvMF1 picture AlvMF1  路  3Comments