is onPress memoized?
See original GitHub issueIs the onPress prop memoized? Because if it is, there is an issue since I am using state in onPress and it using the wrong state.
Using Expo SDK 46
It seems like onPressIn
works because it is directly being passed into the component, but ideally I would like to use onPress
as it is significantly better UX.
Here is a reproducible demo: https://snack.expo.dev/@anshnanda/awesomebutton-not-working
Issue Analytics
- State:
- Created a year ago
- Comments:14
Top Results From Across the Web
Passing a memoized function to onPress of a component issue
Try removing the true argument as it isn't specified in the docs throttle(500, (x)=>{console.log("help please").
Read more >Memoize!!! - a react (native) performance guide - gists · GitHub
Memoization in React. It's important to memoize heavy computations as well as arrays and object creations so that they don't get re-created on...
Read more >React Hooks: Memoization - Medium
React.memo is a performance optimization tool, a higher order component. It's similar to React.PureComponent but for function components instead ...
Read more >4 tips for improving the performance of your React Native ...
One of the most important steps in improving the performance of a React Native application is to memoize the components that you're using....
Read more >How do you cache FlatList.renderItem? Is ... - Andrei Calazans
You might be asking yourself: how do I properly memoize FlatList's renderItem when its onPress needs to know the ID of the item?...
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 Free
Top 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
Same issue.
@ansh damn this package seems more trouble than its worth. Which is unfortunate cause its really rather good