REACT detect pressing any key on keyboard react - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution
join us

How to detect the pressing any key on the keyboard in react ?


 183

REACT


0

<!DOCTYPE html>
<html>
<head>
<script src="https://fb.me/react-0.14.3.min.js "></script>
<script src="https://fb.me/react-dom-0.14.3.min.js "></script>

</head>
<body>

<script type="text/javascript">

window.addEventListener("keydown", uniKeyCode, false);

function uniKeyCode(event) {

var div = React.DOM.div
var key = event.keyCode;

var HelloWorldComponent = (
div(null,'press a key: ' + key + '')
)

ReactDOM.render(HelloWorldComponent, document.getElementsByTagName('body')[0]);

}

</script>

</body>
</html>


By        
The power of the user (%)
10%



The most helpful REACT solutions

How to get client ip address using react ?How to get client ip address using react ?REACT

Click to see more ...

  19.4K     421

how to get the type of a device using react ?how to get the type of a device using react ?REACT

Click to see more ...

  2.2K     220

create digital clock reactcreate digital clock reactREACT

Click to see more ...

  1.7K     141

country dropdown using reactcountry dropdown using reactREACT

Click to see more ...

  1.2K     127

create alarm clock using reactcreate alarm clock using reactREACT

Click to see more ...

  5.2K     115

How to get latitude and longitude using react/javascript ?How to get latitude and longitude using react/javascript ?REACT

Click to see more ...

  1K     108

get client country reactget client country reactREACT

Click to see more ...

  821     82

get ip address reactget ip address reactREACT

Click to see more ...

  1.1K     81

time ago reacttime ago reactREACT

Click to see more ...

  637     74

detect mobile device reactdetect mobile device reactREACT

Click to see more ...

  609     58

Welcome aboard!
We are happy you are here and
wish you good net-raft!