Class: Ruact::Flight::ReactElement

Inherits:
Object
  • Object
show all
Defined in:
lib/ruact/flight/react_element.rb

Overview

Represents a React element: <div>, <Component>, etc. Wire format: [“$”, type, key, props]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, key: nil, props: {}) ⇒ ReactElement

Returns a new instance of ReactElement.



10
11
12
13
14
# File 'lib/ruact/flight/react_element.rb', line 10

def initialize(type:, key: nil, props: {})
  @type = type
  @key = key
  @props = props
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



8
9
10
# File 'lib/ruact/flight/react_element.rb', line 8

def key
  @key
end

#propsObject (readonly)

Returns the value of attribute props.



8
9
10
# File 'lib/ruact/flight/react_element.rb', line 8

def props
  @props
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/ruact/flight/react_element.rb', line 8

def type
  @type
end