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

86
Visualizações
Avoid repeating params in stack navigation

I am building the auth part of the stack navigation for a react navigation app, and ended with something like thiss:

 <Stack.Screen
        name="a"
        component={a}
        initialParams={{ url }}
      />
      <Stack.Screen name="f" component={f} />
      <Stack.Screen
        name="b"
        component={b}
        initialParams={{ url }}
      />
      <Stack.Screen
        name="c"
        component={c}
        initialParams={{ url }}
      />
      <Stack.Screen
        name="d"
        component={d}
        initialParams={{ url }}
      />

Is there any way I can avoid adding the url initialParams everywhere and add it maybe to the stack group screen around?

I tried to add it in the screenOptions prop in the stack group around, but didn't work.

Do you guys have any suggestion?

Thanks!

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

0

You can create an object and use spread operator on components.

 const initialParams = { initialParams: { url } };


 <Stack.Screen
        name="a"
        component={a}
        {...initialParams}
      />

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