ReasonReact for hipsters.
Switch branches/tags
Nothing to show
Clone or download
Latest commit bc9372a Dec 16, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Add bsdoc Dec 15, 2018
src Memo support, and better forwardRef interface Dec 16, 2018
.gitignore Fix errorboundary and add forwardRef Dec 15, 2018
.npmignore Init Nov 7, 2018 README code example is properly highlighted Dec 14, 2018
bsconfig.json Add bsdoc Dec 15, 2018
package.json v0.0.8 Dec 16, 2018
yarn.lock Add bsdoc Dec 15, 2018

npm Blazing Fast License: MIT


The easiest way to try out bs-react is with create-react-app:

npx create-react-app my-app --scripts-version=bs-reasct-scripts

You can also install bs-react directly:

npm install --save bs-react


BsReact is a fork of ReasonReact adapted to work with Hooks and Context.

Reason React uses the good old createClass under the hood. BsReact has a simplified api that converts components defined in Reason to plain function components, allowing hooks to be used.


We all want to use all the shiny new things from React in Reason. With Hooks, there's no need for anything other than function components, so it makes sense to have a more minimal set of React bindings for Reason.


The api is similar to ReasonReact, but there's only one type of component, and you can only define a render function.


module Counter = {
  let component = ReasonReact.component("Counter");

  let make = (~initial=0, _children) => {
    render: _self => {
      let (count, setCount) = ReactHooks.useState(initial);
        <button onClick={_ => setCount(. count + 1)}>
          {ReasonReact.string("Click me")}

For more details, check out the source. Better docs are coming.


Early experimentation. Expect breaking API changes without warning.


The plan is to support all functionality from React 16/17.

  • Suspense
  • React.lazy
  • React.pure
  • React Native
  • etc

I hope some of these things will make it into ReasonReact in some form.

Later on, making this work with ReactMini or some other pure Reason implementation of React would be cool.

Let's chat on Discord!


More than welcome!


Hooks and Context types are copied from Jared Forsyth.