Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

to_n on Hyperloop::Components should convert back to the js component #219

Open
@catmando

Description

@catmando

Some react libs allow a component class to be passed as a "control". There is no easy to convert a Hyperloop::Component to the underlying JS component. It can be done by doing this:

React::API.class_eval('@@component_classes')[MyComponentClass]

so you could implement to_n like this:

class Hyperloop::Component
  def self.to_n 
    React::API.class_eval('@@component_classes')[self]
  end
end

What should really happen is each Hyperloop::Component should save a link to the native class internally, perhaps get rid of React::API's @@component_classes hash, which is left over from the original reactrb implementation

Also we have to do some checks for builtin in tags like DIV, DIV.to_n should probably return 'DIV' (I think)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions