I have a question about PureComponent in react. As you know, it is really useful in long FlatLists, to avoid unnecessary re-renders. But, what happen if I wrap a PureComponent in a HOC like this:
const CachedImage = withCache(
class CachedImage extends React.PureComponent {
render() {
console.log("Rendering");
return <Image {...this.props} />;
}
}
);
... and use it as FlatList item. I mean, will CachedImage avoid unnecessary re-renders too? I don't know it as it seems that is a child the one which extends PureComponent and not the final component itself...
Thank you.
Pd: withCache HOC is implemented as normally every HOC is:
const withCache = (Component) => {
const Wrapped = (props) => {
...