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

170
Visualizações
React Page filters architecure

I'm trying to think of an infrastructure architecture to implement and use on my application. Basically I have a page with multiple components. enter image description here

the filters and filter options are fetched from an API like this:

const filter1 = [
  {
    id: "id",
    name: "OPTION 1",
  },
  {
    id: "id2",
    name: "OPTION 2",
  },
];

The below components needs to send an API request each of them with the filters selected.

The initial components request needs to be done only when the filters and their defaults value are set so that the API request to get the component data will be with the correct filters.

So far I tried to think about ContextProvider which will store all of my filters state, and then all of the components using it will use the context and the state to make an API call.

But there are still a few problems with it, 1: I need to think of a way to set all of the filters default values both in the ContextProvider and in the filter state to present the default value selected. 2. I need to prevent the components from performing an API request until all of the default values are populated in the ContextProvider and shown in the filters.

the default values also needs to come from the API.

Am I even thinking about it the right way? What am I missing to make it sensible and easy to code?

about 4 years ago · Juan Pablo Isaza
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