Skip to main content
zerotal

Documentation


Documentation / @zerotal/core / view / safe

Function: safe()

safe(html): SafeHtml

Defined in: view/index.ts:62

Wrap a pre-rendered HTML string as SafeHtml so it passes through renderChildren() without being escaped again.

Use when you have HTML that was produced outside JSX (e.g. a Markdown renderer) and you want to embed it safely into a JSX tree.

Parameters

html

string

Returns

SafeHtml

Example

import { safe } from '@zerotal/core';
<article>{safe(markdownToHtml(post.body))}</article>