Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazysizes + React 16 - Expected server HTML to contain a matching <img> in <noscript> #443

Closed
stephen-last opened this issue Nov 1, 2017 · 3 comments

Comments

@stephen-last
Copy link

Posted this issue over at React, but I'm not sure where the issue is, React 16 or lazysizes.

I'm using React Server Side Rendering (SSR).

I'm trying to use the "the noscript pattern" but I'm seeing this in the console:

Warning: Expected server HTML to contain a matching <img> in <noscript>.

My image component's render method:

render () {
    const { cdn, url, width, height } = this.props

    if (!url) return null

    const noScriptImgProps = {
      src: `${cdn}${url}`,
      className: classNames('product-image'),
      width,
      height
    }

    const imgProps = {
      'data-src': `${cdn}${url}`,
      className: classNames('product-image', 'lazyload'),
      width,
      height
    }

    return (
      <span>
        <noscript>
          <img {...noScriptImgProps} />
        </noscript>
        <img {...imgProps} />
      </span>
    )
  }

Has anyone else seen this happening..?

@stephen-last
Copy link
Author

Pretty sure this is a React thing...

@oliviertassinari
Copy link

So, React isn't supported?

@stephen-last
Copy link
Author

@oliviertassinari Take a look here: facebook/react#11423

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants