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

246
Visualizações
How To Avoid Hard Code On Data In Reactjs

I am working in a project that contains a table name service_type(id,service_name,default_days are the columns of this table) and another table has consignment which contains a lot of columns. But the relation between service_type table to consignment table is one to many. So, consignment table holds the reference of the service_id.So to create a consignment I need to select a service which gives me an Id and I send this Id to the request object of the consignment. But in the consignment for the different service the ui should render differently. For example, I have Economy, Super Economy or Point To Point Services. So, for point to point service in the consignment a page hidden field should be visible and for other it should not. But if I write the logic like below then it will become hardcode. And if any one from the admin changes the service_type in future from point to point to some other name then this piece of code won't work. Then how should I configure the project data so that I can avoid this kind of hardcoding scenerio.

{serviceType.toLowerCase()==='point to point' ? 'The field should be visible': 'Should Not Be visible'}

strong text

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