Created
April 28, 2016 19:40
-
-
Save developit/51d19ba78f3221370abe3aebb8152a18 to your computer and use it in GitHub Desktop.
decko
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from 'preact'; | |
| import { bind } from 'decko'; | |
| class MarkdownEditor extends Component { | |
| constructor() { | |
| super() | |
| this.state = { text: '' }; | |
| } | |
| @bind | |
| onEdit(text) { | |
| this.setState({ text }); | |
| } | |
| render(props, { text }) { | |
| return ( | |
| <main> | |
| <section> | |
| <label>Markdown</label> | |
| <hr /> | |
| <Editor onEdit={this.onEdit} /> | |
| </section> | |
| <section> | |
| <label>Preview</label> | |
| <hr /> | |
| <Markdown text={text} /> | |
| </section> | |
| </main> | |
| ); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from 'preact'; | |
| import { bind } from 'decko'; | |
| class MarkdownEditor extends Component { | |
| state = { text: '' }; | |
| onEdit = (text) => { | |
| this.setState({ text }); | |
| }; | |
| render(props, { text }) { | |
| return ( | |
| <main> | |
| <section> | |
| <label>Markdown</label> | |
| <hr /> | |
| <Editor onEdit={this.onEdit} /> | |
| </section> | |
| <section> | |
| <label>Preview</label> | |
| <hr /> | |
| <Markdown text={text} /> | |
| </section> | |
| </main> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment