This repository has been archived by the owner on Sep 7, 2020. It is now read-only.
0.12.2
-
Added:
BodyContainer
component.
This component is now recommended to used wrap pagesbody
, in replacement of
previous usage ofdangerouslySetInnerHTML
.
Previous method still works but have
a known issue.
To use this component, you can simply replace in your layouts the following
code{ body && <div dangerouslySetInnerHTML={ { __html: html } } /> }
By the following code
<BodyContainer>{ body }</BodyContainer>
Note that you will need to import
BodyContainer
like thisimport { BodyContainer } from "phenomic"
Example of full diff
import Helmet from "react-helmet" import invariant from "invariant" -import { joinUri } from "phenomic" +import { BodyContainer, joinUri } from "phenomic" class Page extends Component { //... { head.title && <h1>{ head.title }</h1> } { header } - { - body && - <div - dangerouslySetInnerHTML={ { __html: html } } - /> - } + <BodyContainer>{ body }</BodyContainer> { props.children } { footer }
(#469)