how to create a keyboard button click event in react js

i am new to react js , i need to create a function in react which can trigger a ESC key pressed event in the
browser

like in jquery var esc = $.Event("keydown", { keyCode: 27 }); $("body").trigger(esc);