The image placeholder is missing

This is my custom Results component:

This is my custom Thumbnail component:

`import React from "react";

const Thumbnail = ({ result }) => {
  return (
    <div>
      <h1>Thumbnail</h1>
    </div>
  );
};


export default Thumbnail;`

This is in my custom index file:

<Results results={results} />

When trying to use Thumbnail component in Results, why is it not displaying the Thumbnail text in Results?

Answer №1

results probably lacks any data. In the event that it does, React would iterate through the array and display a Thumbnail for each item present.

To verify this, assign a simple variable in your code to an array containing, for instance, 3 items. const items = [1,2,3];

After that, utilize this variable to iterate over the Thumbnail component.

export default function Results() {

...
const items = [1,2,3];

return (
<div>
  {items.map(item => (
    <Thumbnail result={item} />
  )}
</div>
)

You should then observe three displayed Thumbnail components

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Generate and store text inputted from contenteditable

As I embark on creating my own custom rich text editor, I have a couple of questions regarding its functionality. First and foremost, is it possible to prepopulate the text area with content? Additionally, I'm seeking guidance on how to save and utili ...

Encountered an issue when executing "npm start": The system does not recognize 'next' as a valid internal or external command

Encountering an issue when running the "npm start" command in the terminal while attempting to create a cryptocurrency tracker using React.js Displayed contents of my package.json file: { "name": "nextjs-crypto-api", "version ...

What is the best way to choose the next adjacent element using a CSS selector with Python Selenium?

The structure of the DOM is as shown below: <ul> <li> <a href="#" role="button" class="js-pagination link" data-page="1">1</a> </li> <li> <a href="#" role="button" class="js-pagination link active" data ...

How can the "not selected" option be disabled in a Vue Select component?

I have implemented a select box in the following manner: JS: Vue.component("v-select", VueSelect.VueSelect); new Vue({ el: "#app", data: { options: [ { countryCode: "AU", countryName: "Australia" }, { countryCode: "CA", countryName: " ...

My node.js code is not producing the expected result. Can anyone point out where I may be going wrong?

I've been working on a BMI calculator where I input two numbers, they get calculated on my server, and then the answer is displayed. However, I'm having trouble receiving the output. When I click submit, instead of getting the answer, I see a lis ...

Warning: The use of 'node --inspect --debug-brk' is outdated and no longer recommended

Encountering this error for the first time, please forgive any oversight on my part. The complete error message I am receiving when running my code is: (node:10812) [DEP0062] DeprecationWarning: `node --inspect --debug-brk` is deprecated. Please use `node ...

Issue with the Edit feature causing conflicts with the local storage and generating error messages

There seems to be an issue with my edit function that is causing it to override the local storage when I attempt to save and interfering with my delete function as well. I have searched through similar posts for a solution but have not been able to pinpo ...

Error: No route found at this location

I've been following a tutorial on integrating Evernote with IBM's DOORS Next Generation and I added the code highlighted below. // app.js app.get("/notebooks", function(req, res) { var client = new Evernote.Client({ token: req.session.oauth ...

Choosing a Query with Puppeteer - Unleashing the Power of Selection in Puppeteer

How do I use Puppeteer to select the html anchor element that clicks and navigates to the Tutorial page? https://i.sstatic.net/6rkNn.png I've tried this but it's not working const puppeteer = require('puppeteer'); const url = process ...

Strange issue with Firefox when utilizing disabled attribute as "disabled"

I found a curious bug in Firefox: Check out (unfortunately not reproducible in jsfiddle) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> < ...

Clicking the button to send the form using JavaScript

Currently, I am dealing with a shopping cart plugin that relies on a basic form on the product page to send values such as price and product name. However, I am facing an issue where this plugin uses a standard submit button to transmit the values, and I w ...

Refreshing the list in a Next.js to-do application post-deletion: a step-by-step guide

I am currently developing a basic to-do application using Next.js, TypeScript, and Axios. I have successfully implemented the delete functionality for tasks, but I am facing an issue with refreshing the tasks list after deletion. I would appreciate any s ...

Tips for displaying a refresh indicator while making an ajax call for refreshing data:

I have successfully implemented jQuery code that refreshes a specific div every 10 seconds without reloading the entire page. However, during this refresh process, the user does not visually perceive any changes happening in the browser. While there are n ...

Tips for managing the submission process for dynamically generated formsORStrategies for

<tr> <form role="form" class="manualImportSubmit" action="http://localhost:5000/XXX" method="post"> <td><input name="yyy" value="FormAValue" type="hidden">TestA</td> <td><input name="before_year" class="fo ...

Javascript selection menu

<body> <script> window.open("http://yourdomain.com:12345/custom/script","_parent"); document.getElementById("dropdown").selectedIndex="2"; </script> </body> Hello, can someone help me troubleshoot my code? My intention is to open ...

What is preventing me from executing this function more than once?

Having this function: const sliderTextChange = document.getElementsByClassName('slider') // text change const changeSliderText = change => { const sliderLeft = document.getElementsByClassName('switch-left') const sliderRight = ...

What is the reason behind FieldSelect returning a string instead of an object like FieldCheckbox?

FieldSelect component from Sharetribe documents is giving me a string, while FieldCheckbox is returning a JSON object. In a specific scenario, I want FieldSelect to store a JSON object. How can I achieve this? Below is the code snippet for reference: I& ...

Two pretensions and an evaluation in an if statement

Currently, I am delving into the well-optimized code for voronoi implementation created by Mike Bostock (d3js). I find myself puzzled by the following snippet of code: if (!(m = (halfedges = cell.halfedges).length)) return; You can view the full code he ...

Limiting the combinations of types in TypeScript

I have a dilemma: type TypeLetter = "TypeA" | "TypeB" type TypeNumber = "Type1" | "Type2" I am trying to restrict the combinations of values from these types. Only "TypeA" and "Type1" can be paired together, and only "TypeB" and "Type2" can be paired tog ...

The integration of a side panel with a chrome extension is experiencing issues

I am working on a chrome extension with the following functionalities - Extract URL path from a specific webpage. (The webpage's URL remains constant) Open this URL in a new tab. It can be either http:// or https://. Embed an iframe containing a sim ...