diff --git a/content/home/examples/a-component-using-external-plugins.js b/content/home/examples/a-component-using-external-plugins.js new file mode 100644 index 00000000..38ba7292 --- /dev/null +++ b/content/home/examples/a-component-using-external-plugins.js @@ -0,0 +1,35 @@ +class MarkdownEditor extends React.Component { + constructor(props) { + super(props); + this.handleChange = this.handleChange.bind(this); + this.state = { value: 'Type some *markdown* here!' }; + } + + handleChange(e) { + this.setState({ value: e.target.value }); + } + + getRawMarkup() { + const md = new Remarkable(); + return { __html: md.render(this.state.value) }; + } + + render() { + return ( +