Method: React::Component::ClassMethods#export_component

Defined in:
lib/react/component/class_methods.rb

#export_component(opts = {}) ⇒ Object



138
139
140
141
142
143
144
145
# File 'lib/react/component/class_methods.rb', line 138

def export_component(opts = {})
  export_name = (opts[:as] || name).split('::')
  first_name = export_name.first
  Native(`Opal.global`)[first_name] = add_item_to_tree(
    Native(`Opal.global`)[first_name],
    [React::API.create_native_react_class(self)] + export_name[1..-1].reverse
  ).to_n
end