Unable to use React.memo in React Native app
See original GitHub issueI want to use React.memo for optimization in react native.
import React from "react";
import { View, Text } from "react-native";
const Memo = React.memo(function() {
return (
<View>
<Text>Ok</Text>
</View>
);
});
class Demo extends React.Component {
render() {
return <Memo />;
}
}
export default Demo;
It gives following error:
TypeError : undefined is not a function (evaluating render(nextProps)). This error is located at : in Demo(at renderApplication.js:34) in RCTView(at View.js:44 )
Can we use React.memo in react native?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:11
Top Results From Across the Web
Unable to use React.memo in React Native app - Stack Overflow
The "component" you are trying to memoize isn't a correct react component, it isn't being passed any props. The react memo HOC is...
Read more >Unable to use React.memo in React Native app-Reactjs
The "component" you are trying to memoize isn't a correct react component, it isn't being passed any props. The react memo HOC is...
Read more >Use React.memo() wisely
When a component is wrapped in React.memo() , React renders the component and memoizes the result. Before the next render, if the new...
Read more >Higher-Order Components - React
In this document, we'll discuss why higher-order components are useful, and how to write your own. Use HOCs For Cross-Cutting Concerns. Note. We...
Read more >Use React Memo to Optimize Performance, Save - Copycat
Optimize React Performance with React Memo and Save $$$ by Caching ... times especially recursive and mathematical functions in a React app.
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
For me the fix was instead of using
I used
and it worked magically 🤣
Getting the following error:
React.memo is not a function