Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

20
Views
Performance optimization for long text in react

In my app user can make comments in various different ways (e.g. from email). To limit the length of comment is not an option. Some real comments are several millions of chars long which makes Comment component to render them around 2-4 seconds.

Is there any known way of optimization I can use to reduce this time?

Comments can be HTML or plain text.

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

The optimal way to do this is to set a maximum initial render to the comment let us say 30 chars this will go for all of the next solutions

Solution 1:

then add a see more... button to let the user selectively expand the desired comment.

Solution 2:

you can also make a separate view to the comment if possible

another page/ view to render the full comment


if the above 2 solutions don't fit then you will have to deal with the loading time and add extra Loaders/ indicators to help the user assess the waiting time

7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs