I am creating a Modal inside a flatlist, but when i close the modal, the whole flatlist re-renders. I know this is because the useState of modal. How can I solve this??
I dont know what to do to prevent the whole modal from re-rendering
I am creating a Modal inside a flatlist, but when i close the modal, the whole flatlist re-renders. I know this is because the useState of modal. How can I solve this??
I dont know what to do to prevent the whole modal from re-rendering
You can try using React.memo with Context API/redux to prevent the re-render.
for example: using memo
actually, you can combine the 2 solutions together to get better performance. Like This;
I hope this will help you.