Importing Reason into JS
Importing a Basic Reason file into Javascript
/* Greeting.re */
[@react.component]
let make = (~name) => <span> {React.string("Hey " ++ name)} </span>;
/* App.js */
import { make as Greeting } from './Greeting.bs'
export default function App() {
return <Greeting name="Peter" />
}
Importing a Component as Default
/* Greeting.re */
[@react.component]
let make = (~name) => <span> {React.string("Hey " ++ name)} </span>;
/* this sets the named export to default */
let default = make;
/* App.js */
import Greeting from './Greeting.bs'
export default function App() {
return <Greeting name="Peter" />
}