preact-safe
v0.1.0
Published
Safe JSX: syntactic sugar over dangerouslySetInnerHTML.
Downloads
5
Readme
Preact Safe
This package is preact version of react-safe
. It provides a syntactic sugar over the raw dangerouslySetInnerHTML
.
Examples
Preact
<h1 dangerouslySetInnerHTML={{__html: page.title}}></h1>
<div dangerouslySetInnerHTML={{__html: renderMD(page.body)}}></div>
Preact Safe
<Safe.h1>{page.title}</Safe.h1>
<Safe.div>{renderMD(page.body)}</Safe.div>
Warning
Preact Safe is a thin wrapper over dangerouslySetInnerHTML
. So all the usual concerns about XSS attacks and security in general apply. Check the above link for more information.
Author
preact-safe © Baoshuo, Released under the MIT License.
Authored and maintained by Baoshuo with help from contributors.
Personal Website · Blog · GitHub @renbaoshuo · Twitter @renbaoshuo