module React::Component::API

Public Instance Methods

set_props(prop, &block) click to toggle source
# File lib/react/component.rb, line 172
def set_props(prop, &block)
  raise "No native ReactComponent associated" unless @native
  %x{
    #{@native}.setProps(#{prop.shallow_to_n}, function(){
      #{block.call if block}
    });
  }
end
set_props!(prop, &block) click to toggle source
# File lib/react/component.rb, line 181
def set_props!(prop, &block)
  raise "No native ReactComponent associated" unless @native
  %x{
    #{@native}.replaceProps(#{prop.shallow_to_n}, function(){
      #{block.call if block}
    });
  }
end
set_state(state, &block) click to toggle source
# File lib/react/component.rb, line 190
def set_state(state, &block)
  raise "No native ReactComponent associated" unless @native
  %x{
    #{@native}.setState(#{state.shallow_to_n}, function(){
      #{block.call if block}
    });
  }
end
set_state!(state, &block) click to toggle source
# File lib/react/component.rb, line 199
def set_state!(state, &block)
  raise "No native ReactComponent associated" unless @native
  %x{
    #{@native}.replaceState(#{state.shallow_to_n}, function(){
      #{block.call if block}
    });
  }
end