Fauna is a flexible database so we can update our schema without breaking any existing functionality. You'll notice that our products all have hard coded images. In this lesson, we'll update our Product
to include an image and import those changes to Fauna.
Shadid Haque: [0:00] Let's add a new field called imageUrl to our product. This is going to be a string type, and it is not required. Since Fauna is a flexible database, we can change our schema like this without breaking the existing data. Let's go ahead and merge our updated schema.
[0:22] I'll go to the product collection and add an imageUrl for one of these products. Let's head back to our code. We're going to add the imageUrl sub-selection to our query. Then, in our ProductItem component, we will replace the default image with the product's image if it exists.
[0:55] Finally, we'll head back to index again. We will destructure loading from useQuery and add some loading state for our page.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!