2

I'm using react.rb in my project, And I want to use bootstrap too. I found the React-Bootstrap,but don't know how to use it in react.rb.

贾延平
  • 68
  • 3

2 Answers2

2

Thanks to @catmando share the answer.

First, define a wrapper:

class RB < React::NativeLibrary
  imports ReactBootstrap
end 

Then, using it like this

RB.Button(bs_style: :default){"My Button"}
贾延平
  • 68
  • 3
0

There is a new way of doing this, simply add require 'reactrb/auto-import' to components.rb then all JS libraries that are required will be automatically imported into the Ruby namespace so after that you can access the JS components directly. See an example here: https://github.com/barriehadfield/reactrb-showcase#working-with-react-bootstrap

BarrieH
  • 373
  • 3
  • 11