Let's say I have a performance-optimized component like this one:
const PerformanceComponent = ({style}) => {
return <View style={style}>...</View>
}
export default React.memo(PerformanceComponent)
and I am using the component inside the parent like this:
{someArray.map((style) => (
<PerformanceComponent style={style} />
)}
I am passing different objects for style, it can look like this:
const styles = {
width: 200,
height: 200
}
Now React.memo will not do the trick because I am passing an object and React will only compare the memoryaddress (I think its called Shallow Compare).
What are my options to avoid unnecessary rerendering (PerformanceComponent), even if the styles-object did not change?