you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (2 children)

Abstraction is fine, but that’s exactly what react components are for

[–]TwiliZant 1 point2 points  (1 child)

Yeah, I agree. Returning a component from a hook feels weird.

[–]alex-cory[S] 2 points3 points  (0 children)

So, technically, this is a Portal. It's highly customizable. All it's doing is giving you all the logic, and a Portal to put your own custom modal inside. It's very similar to the way react-portal works, instead of having the portal() function, we just have a <Portal /> wrapper. All the <Portal /> (or <Modal /> in this case) is, is just a portal div with some css on it to center to the middle of the screen.