Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
95
rated 0 times [  96] [ 1]  / answers: 1 / hits: 101717  / 8 Years ago, thu, march 17, 2016, 12:00:00

For example: codepen



var InputBox = React.createClass({
render: function() {
return (
<input className=mainInput value='Some something'></input>
)
}
});

More From » select

 Answers
0

Functional component:


const handleFocus = (event) => event.target.select();
const Input = (props) => <input type="text" value="Some something" onFocus={handleFocus} />



ES6 class component:


class Input extends React.Component {
handleFocus = (event) => event.target.select();

render() {
return (
<input type="text" value="Some something" onFocus={this.handleFocus} />
);
}
}



React.createClass:


React.createClass({
handleFocus: function(event) {
event.target.select();
},

render: function() {
return (
<input type="text" value="Some something" onFocus={this.handleFocus} />
);
},
})

[#62905] Tuesday, March 15, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
paulinap

Total Points: 346
Total Questions: 86
Total Answers: 97

Location: Dominican Republic
Member since Sun, Sep 4, 2022
2 Years ago
;