Why is `return false` required?
See original GitHub issuePer https://github.com/JedWatson/react-tappable#native-events, it seems like you’re recommending using return false
from an event handler to prevent Tappable from handling the event.
However, it’s a common best practice (and one my company enforces in its own codebase) to never return false
from an event handler, and to always only explicitly call preventDefault
/stopPropagation
/stopImmediatePropagation
on the event object.
Would it be possible to make Tappable respect preventDefault
on the event object such that return false
isn’t required?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:7 (1 by maintainers)
Top Results From Across the Web
When and why to 'return false' in JavaScript? - GeeksforGeeks
These were some of the basic implementations of return false statement in JavaScript. However, there exist some more interesting ...
Read more >Why do i not need to define else for return true and return false?
Only when the loop has actually reached its end, we know we can return false because the number n was not found.
Read more >Return False in JavaScript | Delft Stack
Return false statement is used to prevent something from happening. · When a return false statement is called in a function, the execution...
Read more >JavaScript: What is the return statement? | by Brandon Morelli
This is important. Using return causes your code to short-circuit and stop executing immediately. Consider this example where we have two return ...
Read more >return false is not working in javascript - Salesforce Developers
Hi, Why you are returing false in JS? Is it to avoid the apex method call on button click. If you want to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
PRs accepted
I’d prefer it remain open until someone (myself, maintainers, or someone else) can fix it. That the issue is old doesn’t make it any less of an issue 😃