@vuson1709Submitted 11 months ago
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:
- 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
- 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" />
);
}