DEV Community

Discussion on: ✅useContext ✅ to Update State in List from Detail View (React Native)

Collapse
 
zachalbers profile image
Zachariah Albers

Hey Michael, great article! I was wondering how you would have implemented the feature to add another object to DATA, and have it update the list. Would it be possible to do this without re-rendering the whole DATA?

Collapse
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

Thanks a lot! Adding another data item to DATA should already work without re-rendering the rest of the Components in the list because within the render method of the list item, we're using useMemo and only re-rendering those when title or selected changes.

Try modifying the example and let me know if you run into any issues.