MTU-Automated-Feedback-System / Frontend

0 stars 0 forks source link

Allow html in exercise description #16

Closed RomainClem closed 1 year ago

RomainClem commented 1 year ago

Found a solution using dangerouslySetInnerHTML: `import React from 'react';

const MyComponent = ({ htmlContent }) => { return ( <div dangerouslySetInnerHTML={{ __html: htmlContent }} /> ); };

export default MyComponent; `

The code isn't sanitized which isn't great. Would probably be best to sanitize it first, here is an example: `import React from 'react';

const MyComponent = ({ htmlContent }) => { return ( <div dangerouslySetInnerHTML={{ __html: htmlContent }} /> ); };

export default MyComponent; `