Sha256: 4d07390890ea2ea61ec97d185081431354d5f4d2ca1be601009275fe6f68b0dd

Contents?: true

Size: 683 Bytes

Versions: 11

Compression:

Stored size: 683 Bytes

Contents

# rubocop:disable Style/FileName
# require 'reactrb/deep-compare' to get 0.9 deep compare behavior
module React
  module Component
    module ShouldComponentUpdate

      def props_changed?(next_params)
        next_params != props
      end

      def call_needs_update(next_params, native_next_state)
        component = self
        next_params.define_singleton_method(:changed?) do
          next_params != props
        end
        next_state = Hash.new(native_next_state)
        next_state.define_singleton_method(:changed?) do
          component.native_state_changed?(native_next_state)
        end
        needs_update?(next_params, next_state)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
hyper-react-0.12.7 lib/reactrb/deep-compare.rb
hyper-react-0.12.6 lib/reactrb/deep-compare.rb
hyper-react-0.12.5 lib/reactrb/deep-compare.rb
hyper-react-0.12.4 lib/reactrb/deep-compare.rb
hyper-react-0.12.3 lib/reactrb/deep-compare.rb
hyper-react-0.12.2 lib/reactrb/deep-compare.rb
hyper-react-0.12.1 lib/reactrb/deep-compare.rb
hyper-react-0.12.0 lib/reactrb/deep-compare.rb
hyper-react-0.11.0 lib/reactrb/deep-compare.rb
hyper-react-0.10.0 lib/reactrb/deep-compare.rb
reactrb-0.9.0 lib/reactrb/deep-compare.rb