Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

247
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda