Self review: Displaying images - React Basic

A passionate full-stack developer from @ePlus.DEV
Search for a command to run...

A passionate full-stack developer from @ePlus.DEV
No comments yet. Be the first to comment.
In this module you will explore the basic structure and use of the React.js library. You will learn how to produce single page web applications using React components and to use JSX to style them.
Is the following description true or false? A Single Page Application allows the user to interact with the website without downloading entire new webpages. Instead, it rewrites the current webpage as the user interacts with it. The outcome is that th...
Challenge overview In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary OpenAI công bố mười kết quả mới cho các bài toán lâu năm trong toán h

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary OpenAI công bố mười kết quả mới cho các bài toán lâu năm trong toán h

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary GitHub thử nghiệm policy theo enterprise team, cho phép cấp thêm mode

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary OpenAI giảm mạnh giá GPT-5.6 Luna và Terra, đồng thời chuyển Priority

Is this code a correct way to import an image in React?
import avatar from "./assets/avatar.png"
function UserImage() {
return (
<div>
<img
src={avatar}
alt = "User image"
/>
< /div>
)
}
export default UserImage;
Yes
No
Is this code a correct way to import an image in React?
function UserImage() {
const avatarImg = "https://picsum.photos/400/265";
return (
<div>
<img
src="avatar.png"
alt="User image"
/>
</div>
)
}
export default UserImage;
Yes
No
What's wrong with this code?
function ProfileImage() {
const profileImg = "https://picsum.photos/400/265";
return <img src={profileImg} alt="Profile image" />
}
export default ProfileImage;
Nothing. This code is correct.
There should be parentheses after the return keyword and the img element should spread its attributes over multiple lines.
You must surround the img element with a root, wrapping div element.