       @renderRejected @state.error
 
     else
-      # Until the initial promise is resolved or rejected, show the given children.
-      @props.children ? null
+      try
+        initialRender = if typeof @props.children is 'function'
+          @props.children()
+        else
+          @props.children
+        initialRender ? null
+      catch error
+        @renderRejected error
 
   componentDidUpdate: (prevProps, prevState) ->
     classList = @getDOMNode()?.classList

    React.createElement @props.tag, @props, value

  renderRejected: (error) ->
    @props.catch.call this, error

  defaultThen: (value) ->
    React.createElement @props.tag, @props, value

  defaultCatch: (error) ->
    React.createElement @props.tag, @props, <code>{error.toString()}</code>

      classList?.remove @props.pendingClass

  renderResolved: (value) ->
    if typeof @props.children is 'function'
      @props.children(null, value) ? null
    else if @props.then?
      if typeof @props.then is 'string'
        @renderSimpleLookup value, @props.then.split '.'
      else
        @props.then.call this, value
    else
      null

  renderSimpleLookup: (value, path) ->
    until path.length is 0
