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.
list_components_as
method #159
Open
Description
Implement the following pattern
class Foo < React::Component::Base
def self.my_components
@my_components ||= []
end
before_mount { self.class.my_components << self }
after_mount { self.class.my_components.delete(self) }
with this macro
class Foo < React::Component::Base
list_components_as :my_components
end
You could of course implement a components
method that works for all classes, but this way you only have the (slight) overhead when you really need it...