Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

React Futures - Server Components

import marked from 'marked';
import sanitizeHtml from 'sanitize-html';
// [...]

export default function TextWithMarkdown({text}) {
  return (
    <div
      className="text-with-markdown"
      dangerouslySetInnerHTML={{
        __html: sanitizeHtml(marked(text), {
          allowedTags,
          allowedAttributes,
        }),
      }}
    />
  );
}
Source by www.codeproject.com #
 
PREVIOUS NEXT
Tagged: #React #Futures #Server #Components
ADD COMMENT
Topic
Name
8+9 =