Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!