article update

This commit is contained in:
tmshv committed 2020-03-04 15:41:28 +03:00
1 parent bf007b583c
commit 830a193333
5 files changed
+42 -35

No files matched your search

+12 -3
View File
@@ -1,7 +1,16 @@
import { createElement } from 'react'
export type HtmlProps = {
className?: string
as?: keyof HTMLElementTagNameMap
html: string
}
export const Html: React.FC<HtmlProps> = props => (
<div dangerouslySetInnerHTML={{ __html: props.html }} />
)
export const Html: React.FC<HtmlProps> = ({ as = 'div', ...props }) => {
return createElement(as, {
className: props.className,
dangerouslySetInnerHTML: {
__html: props.html,
}
})
}