0

Can someone share their approach on using modals with the react-rails gem? I've tried a few solutions like material-ui and others and I keep either getting errors or unresponsive modals.

I'm using:

  • The react-rails gem
  • Browserify-rails
  • Reactify

I'm interested in anyone's approach really. I've done a few small applications with react-rails, but i'm fairly new to all the other tools and unsure how it might affect trying to bring in third-party modules like material-ui.

Thanks

Jshoe523
  • 3,851
  • 2
  • 18
  • 21

1 Answers1

0

I couldn't find a great solution for this either so I ended up building my own React 'wrapper' component that takes in children to display modals.

<ModalWrapper>**child jsx/component to display in modal**</ModalWrapper>

ModalWrapper contains a fixed 'cover' div and a centered 'modal-container' div. The modal would be rendered conditionally based on a boolean state.

I like the solution since it doesn't require dependencies, provides full control using React patterns, and really doesn't take too long to set up, particularly if you're going to be display a lot of them. However I, too, would be interested in any other answers people might offer here.

bplittle
  • 355
  • 2
  • 9
  • I was hoping creating my own modal component would be a last option, but I guess it doesn't hurt. Anyways, thanks for the heads up – Jshoe523 Nov 08 '15 at 05:28