Course "Powering Up With React" is too short. Here is my question. Assuming that we have 2 React components. One is ul and the other is li. Both have an onClick method but different implementations. How to prevent onClick being executed for ul component (parent/container) when user clicks li? I think this is very common case. Couldn't find it in the course. I have found the answer with event.stopPropagation but have been wondering if there is another way to do that.
Best Regards, Szymon
HI Szymon! I don't know of another way, but using stopPropagation is likely the proper way; best to use that.
as React events are very much like standard browser events , and stopPropagation is also in React's SyntheticEvent's interface.