I've used React Quill for RichText Editor. And also saved data as html format. The Response shows in the Api like below:
"education": "<ul><li>Bachelor of Science (BSc) in Computer Science & Engineering, </li><li>Master of Science (MSc) in Computer Science & Engineering</li></ul><p><br></p>"
I used the following code to show in html format to view the data. But the data is showing without the list format. Only show text data.
import DOMPurify from "dompurify"; // Import DOMPurify at the beginning of your file// Function to sanitize HTML to prevent XSS attacksconst sanitizeHTML = (html) => { return { __html: DOMPurify.sanitize(html), };};// JSX for rendering education with proper formatting<div className="text-lg" dangerouslySetInnerHTML={sanitizeHTML(jobDescription.education)} // Sanitize and render HTML/>
Expected Result:
- Bachelor of Science (BSc) in Computer Science & Engineering,
- Master of Science (MSc) in Computer Science & Engineering