Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

100
Visualizações
How to populate components on a new page when clicking on component in current page

I'm building a front-end project in React and in it, I want to be able to click on a thumbnail image component on a Home page that will redirect me to another page that renders components depending on the information for the thumbnail component that I clicked on.

For reference, this is a project that allows users to search for recipes from an external API. The thumbnail component they'll be clicking on will be an image and title of a recipe. When they click on that component they will get redirected to a meal page that has components for recipe name, image, servings, ingredients, directions, etc. and those components will render using information from the thumbnail from the Home page.

To summarize, here's what I want to do: When I click on a recipe in the Home page, I want to be redirected to a page that shows information for the recipe I clicked on.

So my main question is 'Is this possible?'

Thanks and feel free to let me know if you need more info.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

To achieve that you probably should use a package named 'react-router-dom'.

  1. You should setup a react-router. Here is docs for that.
<Route path="/recipe/:id">
  <RecipePage />
</Route>
  1. Your thumbnail should navigate to Recipe Page with the given ID.
  2. You should fetch recipe data from API:
// Recipe page  

import { useHistory, useParams } from 'react-router-dom'


const { id } = useParams()
const recipe = await fetch('api/recipe/' + id)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda