question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why is `return false` required?

See original GitHub issue

Per 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:open
  • Created 8 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dcousenscommented, May 8, 2017

PRs accepted

0reactions
ljharbcommented, Apr 4, 2018

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 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found