Module: React::Component::ShouldComponentUpdate

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

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/react/component/should_component_update.rb', line 4

def self.extended(base)
  base.define_singleton_method(:should_component_update?) do |&block|
    `base.has_custom_should_component_update = true`
    define_method(:should_component_update) do |next_props, next_state|
      !!block.call(Hash.new(next_props), Hash.new(next_state))
    end
  end
end