Module: React::Component::API
- Defined in:
- lib/react/component/api.rb
Instance Method Summary collapse
- #dom_node ⇒ Object
- #force_update! ⇒ Object
- #mounted? ⇒ Boolean
- #set_props(prop, &block) ⇒ Object
- #set_props!(prop, &block) ⇒ Object
- #set_state(state, &block) ⇒ Object
- #set_state!(state, &block) ⇒ Object
Instance Method Details
#dom_node ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/react/component/api.rb', line 4 def dom_node if `typeof React.findDOMNode === 'undefined'` `#{self}.native.getDOMNode` # v0.12.0 else `React.findDOMNode(#{self}.native)` # v0.13.0 end end |
#force_update! ⇒ Object
16 17 18 |
# File 'lib/react/component/api.rb', line 16 def force_update! `#{self}.native.forceUpdate()` end |
#mounted? ⇒ Boolean
12 13 14 |
# File 'lib/react/component/api.rb', line 12 def mounted? `#{self}.native.isMounted()` end |
#set_props(prop, &block) ⇒ Object
20 21 22 |
# File 'lib/react/component/api.rb', line 20 def set_props(prop, &block) set_or_replace_state_or_prop(prop, 'setProps', &block) end |
#set_props!(prop, &block) ⇒ Object
24 25 26 |
# File 'lib/react/component/api.rb', line 24 def set_props!(prop, &block) set_or_replace_state_or_prop(prop, 'replaceProps', &block) end |
#set_state(state, &block) ⇒ Object
28 29 30 |
# File 'lib/react/component/api.rb', line 28 def set_state(state, &block) set_or_replace_state_or_prop(state, 'setState', &block) end |
#set_state!(state, &block) ⇒ Object
32 33 34 |
# File 'lib/react/component/api.rb', line 32 def set_state!(state, &block) set_or_replace_state_or_prop(state, 'replaceState', &block) end |