Docs / ReasonReact / IntroExample

Intro Example

Here is a small overview of the ReasonReact API before we start. No worries if some of these are unfamiliar; the docs cover all of them.

The component "Greeting"

/* file: */ [@react.component] let make = (~name) => <button> {ReasonReact.string("Hello " ++ name ++ "!")} </button>;

A usage of the component

(assuming there's a div on the page with id greeting)

/* file: */ ReactDOMRe.renderToElementWithId(<Greeting name="John" />, "greeting");