Y
Y
yumakaev2020-01-23 09:28:49
React
yumakaev, 2020-01-23 09:28:49

How to display logos according to id?

Good day!
There are two tables in the database,
the first is "projects" the
second is "company"
In the first I store a list of projects, in the second the companies that these projects ordered
PBCgEMZ.png?1
In the second, the name of the company and a link to the logo
BaxKihw.png?1
But when I create a project, selecting the customer company , all logos are displayed...
zglVPtF.png?1

const onGetCompanyListDetails = () => {
    return projectsList.map(projects => {
      const logoUrl = companyList.find(i => i.id === projects.companyId).imgUrl;
      return <img key={projects.id} src={logoUrl} />
    });
  };

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Koryakin, 2020-01-23
@zettend

Better make companyName a separate endpoint. Those.
/company/companyName/id,url,imgUrl.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question