ReasonReact

ReasonReact

  • Docs
  • Try
  • Examples
  • Community
  • Blog
  • Languages iconEnglish
    • ζ—₯本θͺž
    • EspaΓ±ol
    • FranΓ§ais
    • ν•œκ΅­μ–΄
    • PortuguΓͺs (Brasil)
    • Русский
    • δΈ­ζ–‡
    • 繁體中文
    • Help Translate
  • GitHub

β€ΊRecipes & Snippets

Recipes & Snippets

  • A List of Simple Examples
  • Adding data-* attributes
  • Working with Optional Data
  • Render Props
  • Importing JS into Reason
  • Importing Reason into JS
  • ReasonReact using ReactJS
  • ReactJS using ReasonReact
  • Example Projects
  • GraphQL & Apollo
  • Styling: Tailwind CSS
Edit

ReactJS using ReasonReact

PageReason.re:

/* ReasonReact used by ReactJS */
[@react.component]
let make = (~message, ~extraGreeting=?) => {
  let greeting =
    switch (extraGreeting) {
    | None => "How are you?"
    | Some(g) => g
    };
  <div> <MyBannerRe show=true message={message ++ " " ++ greeting} /> </div>;
};

Then use it on the JS side through

var PageReason = require('path/to/PageReason.js').make;
← ReasonReact using ReactJSNext β†’