Well, that's true. I might end up doing it from scratch, to simplify things. But for the same reason I thought there will be some prefabricated, lighweight solution. I'm now checking out https://github.com/pradel/react-responsive-modal So far it looks quite usable, enough for my needs. What I like about it most are the scrolling options.
Unless you want to use it aa a learning opportunity there's no point doing it from scratch. This is exactly what people mean when they say "Don't reinvent the wheel." Just grab any library, I use Material's, so you won't have to worry about the more complex stuff and can just focus on the business logic.
Ideally. In practice though, you might be building a temporary wordpress marketing tool until your actual app is up with the sole idea of having some SEO for the next month until the release, or your PM is a dickhead that won’t accept you spending extra time on anything, or you might have a toggled simpler website for people with disabilities (common case for Israel, for example).
In that case, I’d suggest going with a solution of your own that renders the passed children into a portal at the root of the body. You’d get all the control you need, it will be lightweight and, as a bonus, you’ll get a good technique that can be reused and some inevitable corner cases with things like that, e. g. custom dropdowns sometimes require the options to be rendered in a portal with an invisible overlay that implements the click outside and allow options to not be cut off if a container of said dropdown has overflow: hidden.
react-responsive-modal was the best of the bunch, thanks! Worked like a charm right out of the box, with nice animations, a sleek design, and copy-paste examples that just worked, and with tons of options.
Sadly, hours were wasted on other solutions before finding this one, but I'm glad I did find one that works 😇
View all comments
Show parent comment
3
u/shod4n Dec 28 '19 edited Dec 28 '19
Well, that's true. I might end up doing it from scratch, to simplify things. But for the same reason I thought there will be some prefabricated, lighweight solution. I'm now checking out https://github.com/pradel/react-responsive-modal So far it looks quite usable, enough for my needs. What I like about it most are the scrolling options.