Sha256: dbf7cd807ce1d73cc6695674f10aeaa7d527455d378fe2b7bdf3e7a31cf9e45e

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

module React
  module DOM
    $$.React.DOM.each do |name, factory| 
      define_method(name) do |props = nil, children = nil, &block|
        if children.nil?
          if `Array.isArray(props)`
            children = props
            props = nil
          elsif !props.nil? && `typeof props !== 'object'`
            children = [props]
            props = nil
          end
        end
        `return factory(#{React.fix_props(props)}, #{children.to_n});`
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-react-0.0.4 lib/opal/react/dom.rb