I\'ve been reading these links: https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-shouldcomponentupdate https://reactjs.org/blog/2018/10/23/react-v-16-6.htm
Here is the documentation for React.memo
You can pass a function to control the comparison :
const Modal = React.memo( props => {...}, (prevProps, nextProps) => prevProps.show === nextProps.show );
when the function returns true, the component will not be re-rendered
true