2

This app has some components, used as parent -> child 1 | child 2 -> sub-child and so on.

Almost all of them implement keydown event listener, for pretty much same keys.

Now, the issue is... consider this case:

Parent has a child component, both have keydown event listener. I want if child component handles key event for "arrowDown", then parent component should do nothing, otherwise parent component should handle "arrowDown" press.

In inheritance, I'd override the parent class' method, and conditionally call super(). Easy. How do we handle this case in React?

Any examples?

TheKalpit
  • 1,426
  • 1
  • 14
  • 26
  • 1
    https://stackoverflow.com/questions/34522931/example-for-bubbling-and-capturing-in-react-js refer to this link to handle the bubbling and capturing phase differently using react Js – venkata krishnan Sep 14 '17 at 09:15

0 Answers0