Sha256: 91ab0cfe54d85424b4184543e0ce59f270ce984d75db64c8659e3dddf3dde092

Contents?: true

Size: 580 Bytes

Versions: 10

Compression:

Stored size: 580 Bytes

Contents

class Route < Preact::Component

  self.context_type = RouterContext

  render do
    route_match = @context[:router][:matcher].call(props[:path], @context[:location])
    matches, params = props[:match] || route_match
    if matches
      component = props[:component]
      component_props = props[:component_props] || {}
      if component
        component = component.constantize if component.is_a?(String)
        Preact.create_element(component, component_props.merge!({ params: params }))
      else
        props[:children]
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
isomorfeus-preact-23.6.0.rc5 lib/route.rb
isomorfeus-preact-23.6.0.rc4 lib/route.rb
isomorfeus-preact-23.6.0.rc3 lib/route.rb
isomorfeus-preact-23.6.0.rc2 lib/route.rb
isomorfeus-preact-23.6.0.rc1 lib/route.rb
isomorfeus-preact-23.1.0.rc2 lib/route.rb
isomorfeus-preact-23.1.0.rc1 lib/route.rb
isomorfeus-preact-22.11.0.rc1 lib/route.rb
isomorfeus-preact-22.10.0.rc2 lib/route.rb
isomorfeus-preact-22.10.0.rc1 lib/route.rb