Created
September 24, 2017 14:55
-
-
Save mrkaspa/09f131f0669736c4217c7441c55aa64d to your computer and use it in GitHub Desktop.
Fable interfacing with react components
This file contains 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
type [<Pojo>] Props = | |
{ source: string } //other properties here | |
[<Import("default", "react-markdown")>] | |
type private ReactMarkdown (props) = inherit Component<Props, obj> (props) | |
//create using | |
let view _ _ = | |
let props = { source = "# This is a header\n\nAnd this is a paragraph" } | |
com<ReactMarkdown, _, _> props [] //props is Props |
This file contains 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
type [<Pojo>] Props = | |
{ source: string } //other properties here | |
let ReactMarkdown = importDefault<Props -> ReactElement> "react-markdown" | |
//create using | |
let view _ _ = | |
let props = { source = "..." } | |
fn ReactMarkdown props [] //props is Props |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment