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 (also: #set_props!)
- #set_state(state, &block) ⇒ Object
- #set_state!(state, &block) ⇒ Object
Instance Method Details
#dom_node ⇒ Object
4 5 6 |
# File 'lib/react/component/api.rb', line 4 def dom_node `ReactDOM.findDOMNode(#{self}.native)` # react >= v0.15.0 end |
#force_update! ⇒ Object
12 13 14 15 |
# File 'lib/react/component/api.rb', line 12 def force_update! `#{self}.native.forceUpdate()` self end |
#mounted? ⇒ Boolean
8 9 10 |
# File 'lib/react/component/api.rb', line 8 def mounted? `(#{self}.is_mounted === undefined) ? false : #{self}.is_mounted` end |
#set_props(prop, &block) ⇒ Object Also known as: set_props!
17 18 19 |
# File 'lib/react/component/api.rb', line 17 def set_props(prop, &block) raise "set_props: setProps() is no longer supported by react" end |
#set_state(state, &block) ⇒ Object
22 23 24 |
# File 'lib/react/component/api.rb', line 22 def set_state(state, &block) set_or_replace_state_or_prop(state, 'setState', &block) end |
#set_state!(state, &block) ⇒ Object
26 27 28 29 |
# File 'lib/react/component/api.rb', line 26 def set_state!(state, &block) set_or_replace_state_or_prop(state, 'setState', &block) `#{self}.native.forceUpdate()` end |