DocsPlaygroundBlogCommunity
  • Playground
  • Blog
  • Community
  • X
  • Bluesky
  • GitHub
  • Forum
Language ManualAPISyntax LookupReact
rescript-react
Overview
  • Introduction
  • Installation
    • Exposed Modules
  • Migrate from ReasonReact
Main Concepts
  • Elements & JSX
  • Rendering Elements
  • Components and Props
  • Arrays and Keys
  • Refs and the DOM
  • Context
  • Styling
  • Router
Hooks & State Management
  • Hooks & State Management Overview
  • useEffect Hook
  • useState Hook
  • useReducer Hook
  • useContext Hook
  • useRef Hook
  • Build A Custom Hook
Guides
  • Beyond JSX
  • Forwarding Refs
Extra
  • LLMs
Docs / rescript-react / Installation
Edit

Installation

Requirements:

  • rescript >=9.1.2 < 10.0 (alternatively for older codebases: [email protected] or later)

  • react >=16.8.1 < 18.0.0 or later

Add following dependency to your ReScript project (in case you don't have any project yet, check out the installation instructions in the manual):

npm install @rescript/react

Then add the following setting to your existing bsconfig.json:

JSON
{ "reason": { "react-jsx": 3 }, "bs-dependencies": ["@rescript/react"] }

To test your setup, create a new .res file in your source directory and add the following code:

RES
// src/Test.res @react.component let make = () => { <div> {React.string("Hello World")} </div> }

Now run npx rescript and you should see a successful build.

Exposed Modules

After a successful installation, @rescript/react will make following modules available in your project's global scope:

  • React: Bindings to React

  • ReactDOM: Bindings to the ReactDOM

  • ReactDOMServer: Bindings to the ReactDOMServer

  • ReactEvent: Bindings to React's synthetic events

  • ReactDOMStyle: Bindings to the inline style API

  • RescriptReactRouter: A simple, yet fully featured router with minimal memory allocations

IntroductionMigrate from ReasonReact

© 2025 The ReScript Project

Software and assets distribution powered by KeyCDN.

About
  • Community
  • ReScript Association
Find us on