I started learning Reactjs today and found an interesting fact (and din't find any relevant topic) that we must use preventDefault
than using return false
statement to prevent the default behavior: https://reactjs.org/docs/handling-events.html
But as far as I know, return false is equivalent to (from jQuery background):
// e.preventDefault();
// e.stopPropagation();
// stop function execution after return false
// stops the callback function
But I'm curious to know here how react has implemented so that we cannot use return false
statement and we must use preventDefault
to prevent the default behavior.
So, what's exactly difference between preventDefault
and return false
when it comes to reactjs? Why preventDefault
is more robust than return false
in reactjs?