Skip to content

Commit a235df9

Browse files
authored
Add ReScript-React migration guide (#267)
1 parent 05a78f2 commit a235df9

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

data/sidebar_react_latest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"Overview": [
33
"introduction",
4-
"installation"
4+
"installation",
5+
"migrate-from-reason-react"
56
],
67
"Main Concepts": [
78
"elements-and-jsx",

pages/docs/react/latest/installation.mdx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ canonical: "/docs/react/latest/installation"
66

77
# Installation
88

9-
**Requirements:**
9+
**Requirements:**
1010

11-
- `[email protected]` or later
11+
- `[email protected]` or later
1212
- `[email protected]` or later
1313

1414
Add following dependency to your ReScript project (in case you don't have any project yet, check out the [installation instructions](/docs/manual/latest/installation) in the manual):
@@ -38,7 +38,7 @@ let make = () => {
3838

3939
Now run `npx bsb -make-world` and you should see a successful build.
4040

41-
## Exposed Modules
41+
## Exposed Modules
4242

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

@@ -48,12 +48,3 @@ After a successful installation, `@rescript/react` will make following modules a
4848
- `ReactEvent`: Bindings to React's synthetic events
4949
- `ReactDOMStyle`: Bindings to the inline style API
5050
- `RescriptReactRouter`: A simple, yet fully featured router with minimal memory allocations
51-
52-
53-
### Deprecated Modules
54-
55-
`rescript-react` has gone a long way, so we still keep around a few modules for legacy reasons. We will deprecate them in the future in favor of...
56-
57-
- `ReactDOMRe` -> `ReactDOM`
58-
59-
Actual usage and for each module will be discussed in the rest of this documentation.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: Migrate from ReasonReact
3+
description: "Migrate from ReasonReact"
4+
canonical: "/docs/react/latest/migrate-from-reason-react"
5+
---
6+
7+
# Migrate from ReasonReact
8+
9+
ReScript-React is mostly feature-compatible with ReasonReact, with a few long deprecated modules now removed:
10+
11+
- `ReactEventRe`: use `ReactEvent`.
12+
- `ReactDOMServerRe`: use `ReactDOMServer`.
13+
- `ReactDOMRe`: use `ReactDOM`.
14+
- `ReasonReact`: use `React`.
15+
- `ReasonReactCompat` fully removed. Was [used](https://reasonml.github.io/reason-react/docs/en/reasonreactcompat) to migrate to ReasonReact `0.7.0`.
16+
17+
Reminder: for `ReactDOMRe.renderToElementWithClassName` and `ReactDOMRe.renderToElementWithId`, use `ReactDOM.querySelector` + `ReactDOM.render` if you haven't moved to `ReactDOM` already previously.
18+
19+
Note: to migrate to ReScript-React, you need to be on ReasonReact `>=0.8.0`. If not, please first [upgrade to the latter](https://github.com/reasonml/reason-react/blob/master/HISTORY.md#080-042020). Sorry for the trouble.

0 commit comments

Comments
 (0)