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

278
Views
SyntaxError: unterminated string literal React

In my application, I wrote a custom component to display the header and subheader for each page. See code below:

      <H 
        header = "Header" 
        subheader = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, \
        sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
      />

Problem: I want to split the string across multiple lines, so I added a backslash \ as suggested to do in this source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Unterminated_string_literal.

However, when the page is rendered the \ is included in the subheader text.

How can I have multiple line string with the correct text displaying?

Note: I also tried in single vs double quotes and tried using the +operator.

Update: I got it to work by adding `` between the text and by placing {} around everything.

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!