Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Last active March 14, 2019 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luandevpro/36df032824ed4512d2d8c2ccfd037085 to your computer and use it in GitHub Desktop.
Save luandevpro/36df032824ed4512d2d8c2ccfd037085 to your computer and use it in GitHub Desktop.
...
import { stateToHTML } from "draft-js-export-html";
import Parser from "html-react-parser";
...
render() {
var { editorState } = this.state;
return (
<div>
<Formik
initialValues={{ editorState }}
onSubmit={this.handleSubmit}
>
{props => <FormField {...props} />}
</Formik>
<div style={{ textAlign: "justify" }}>
{Parser(stateToHTML(this.state.editorState.getCurrentContent()))}
</div>
</div>
);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment