Module: React::Component::API
- Includes:
- Native
- Defined in:
- lib/react/component.rb
Instance Method Summary collapse
- #set_props(prop, &block) ⇒ Object
- #set_props!(prop, &block) ⇒ Object
- #set_state(state, &block) ⇒ Object
- #set_state!(state, &block) ⇒ Object
Instance Method Details
#set_props(prop, &block) ⇒ Object
172 173 174 175 176 177 178 179 |
# 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) ⇒ Object
181 182 183 184 185 186 187 188 |
# 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) ⇒ Object
190 191 192 193 194 195 196 197 |
# 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) ⇒ Object
199 200 201 202 203 204 205 206 |
# 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 |