Skip to content

Uncaught Error: A valid ReactComponent must be returned. #6

Open

Description

@ArnoBuschmann

Hi :)

When I use your component, I get this error message:

Uncaught Error: A valid ReactComponent must be returned.

Figured, this happens because React is considering the component only valid if its enclosed in div tags. So when changing your code as below, things work properly well.

    return (
      <div>
        <img
          {...this.props}
          style={style}
          src={this.props.src}
          onLoad={this.fadeIn}
        />
      </div>
    )

Activity

  1. zackify commented on Apr 11, 2016

    @zackify
    Member

    I made this a while ago, I'll check it out and update it tonight!
    On Mon, Apr 11, 2016 at 19:36 ArnoBuschmann notifications@github.com
    wrote:

    Hi :)

    When I use your component, I get this error message:

    Uncaught Error: A valid ReactComponent must be returned.

    Figured, this happens because React is considering the component only
    valid if its enclosed in div tags. So when changing your code as below,
    things work properly well.

    return (
      <div>
        <img
          {...this.props}
          style={style}
          src={this.props.src}
          onLoad={this.fadeIn}
        />
      </div>
    )
    

    —
    You are receiving this because you are subscribed to this thread.
    Reply to this email directly or view it on GitHub
    #6

  2. ArnoBuschmann commented on Apr 11, 2016

    @ArnoBuschmann
    Author

    Yep. It's useful, thanks for creating it.

  3. zackify commented on Apr 13, 2016

    @zackify
    Member

    I don't see this happening at all after testing. Any way you could provide a stack trace or some more code?

  4. zackify commented on Apr 15, 2016

    @zackify
    Member

    I'm going to close this in a couple days if no reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions