Managing React modals with singleton component design
▻https://hackernoon.com/managing-react-modals-with-singleton-component-design-5efdd317295b?sourc
(This post was originally posted to my personal blog)Controlling modals of all kinds (informational modals, custom alerts, image lightboxes, …) across an application is a frustrating problem that we all face when developing apps. When the app is simple, it’s sufficient to place a single <Modal /> component and have a state to toggle it on/off. However, things get complicated when you have different places to present the same modal or different kinds of modal to display in your app.There have been a couple of design solutions for this such as using the React Context API (this blog is an example) or manipulating react-navigation’s StackNavigator (as described in this blog post). In this post, I would like to share my own design for this problem using a singleton <Modal /> (...)
#react-native #javascript #manage-react-modals #react-modal #reactjs