How to protect your service from XSS by using sanitize-html 【React】

import sanitizeHtml from 'sanitize-html';sanitize(text: ?string): string {  const cleanText = sanitizeHtml(text, {    allowedTags: ['p'],  });  return cleanText;}

My LinkedIn account. Please follow me!

https://www.linkedin.com/in/tomoharu-tsutsumi-56051a126/

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store