Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • vuson1709 120

    @vuson1709

    Submitted

    In App.js, I use this approach to change from illustration-sign-up-mobile.svg to illustration-sign-up-desktop.svg``` when width > 800px`. But I am not sure if this is a good solution because:

    1. When I change from desktop to mobile view using Chrome DevTool with dimension: iPhone SE, I have to refresh the page so that the website updates the mobile svg. Pic1 Pic2 Pic3
    2. when I change back from mobile to desktop, i have to refresh the page again so that the website updates the desktop svg of my image. Pic4 Pic5
    function Banner() {
      return window.screen.width > 800 ? (
        <img src={BannerDesktop} alt="Banner Desktop" className="banner-desktop" />
      ) : (
        <img src={BannerMobile} alt="Banner Mobile" className="banner-mobile" />
      );
    }
    
    vuson1709 120

    @vuson1709

    Posted

    I found the solution, here is my updated code:

    function Banner() {
      return (
        <picture>
          <source media="(min-width:800px )" srcSet={BannerDesktop} />
          <img src={BannerMobile} alt="Banner Mobile" className="banner-mobile" />
        </picture>
      );
    }
    
    0