Skip to content

Instantly share code, notes, and snippets.

@mrkaspa
Created September 24, 2017 14:55
Show Gist options
  • Save mrkaspa/09f131f0669736c4217c7441c55aa64d to your computer and use it in GitHub Desktop.
Save mrkaspa/09f131f0669736c4217c7441c55aa64d to your computer and use it in GitHub Desktop.
Fable interfacing with react components
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
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