Method: React::Component::ClassMethods#imports
- Defined in:
- lib/react/component/class_methods.rb
#imports(component_name) ⇒ Object
147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/react/component/class_methods.rb', line 147 def imports(component_name) React::API.import_native_component( self, React::API.eval_native_react_component(component_name) ) define_method(:render) {} # define a dummy render method - will never be called... rescue Exception => e # rubocop:disable Lint/RescueException : we need to catch everything! raise "#{self} cannot import '#{component_name}': #{e.message}." # rubocop:enable Lint/RescueException ensure self end |