re: The neatest way to handle alert dialogs in React 🥰 VIEW POST



I have used this technique for 2 past React projects before ✌️✌️✌️

I used a global hook state manager that I created (github.com/devhammed/use-global-hook) then renders my custom Material UI Dialog component near routes in App.js then all I have to do is to call the showModal action (I use React.useReducer) whenever I need to:

  title: "Hello",
  content: (<Typography>Hi</Typography>),
  actions: [] // buttons

Cool, can you share some examples for your implementation?


The implementation is almost the same with the one in this post but I used use-global-hook instead of context (though it uses context under the hood too).

Code of Conduct Report abuse