Hi,
I'm working on the AirBnB clone section, following along in my own IDE. I'm currently at the part where we are learning about Props, passing the cat images from App.js to Contact.js.
The only way I found to get this to work was to import the images into App.js at the top of the file, then pass that (keyword/variable/object?) as props to Contacts.js
e.g.
import React from "react"
import cat1 from "./images/cat1.png"
function App() {
return (
<div className="contacts">
<Contact
image={cat1}
name="Cat 1"
/>
</div>
)
}
Is this the correct way to do it? So every time I want to use an image in React like this, I need to first import it, then pass that as props? Is this how you would do it if you were grabbing an image from a URL, as well?
Thanks
Lesson for reference: https://scrimba.com/learn/learnreact/props-part-4-receiving-props-in-a-component-co88c4bfa84d99b466b78e914