You can use event.key
function Input({onKeyPress}) {_x000D_
return (_x000D_
<div>_x000D_
<h2>Input</h2>_x000D_
<input type="text" onKeyPress={onKeyPress}/>_x000D_
</div>_x000D_
)_x000D_
}_x000D_
_x000D_
class Form extends React.Component {_x000D_
state = {value:""}_x000D_
_x000D_
handleKeyPress = (e) => {_x000D_
if (e.key === 'Enter') {_x000D_
this.setState({value:e.target.value})_x000D_
}_x000D_
}_x000D_
_x000D_
render() {_x000D_
return (_x000D_
<section>_x000D_
<Input onKeyPress={this.handleKeyPress}/>_x000D_
<br/>_x000D_
<output>{this.state.value}</output>_x000D_
</section>_x000D_
);_x000D_
}_x000D_
}_x000D_
_x000D_
ReactDOM.render(_x000D_
<Form />,_x000D_
document.getElementById("react")_x000D_
)
_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>_x000D_
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>_x000D_
<div id="react"></div>
_x000D_