Module: React::Component::API

Defined in:
lib/react/opal/component/api.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/react/opal/component/api.rb', line 4

def self.included(base)
  base.include(::React::PropsChildren)
end

Instance Method Details

#dom_nodeObject



24
25
26
# File 'lib/react/opal/component/api.rb', line 24

def dom_node
  raise "`dom_node` is deprecated in favor of `React.find_dom_node`"
end

#force_update!Object



12
13
14
# File 'lib/react/opal/component/api.rb', line 12

def force_update!
  `#{self}.forceUpdate()`
end

#set_state(state, &block) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/react/opal/component/api.rb', line 16

def set_state(state, &block)
  %x{
  #{self}.setState(#{state.shallow_to_n}, function(){
      #{block.call if block}
    });
  }
end

#stateObject



8
9
10
# File 'lib/react/opal/component/api.rb', line 8

def state
  Hash.new(`#{self}.state`)
end