Skip to content
No description, website, or topics provided.
OCaml
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src handle children better Apr 10, 2019
test handle children better Apr 10, 2019
.gitignore Again Jan 9, 2018
README.md links and version numbers Apr 9, 2019
bsconfig.json Correct refmt Apr 25, 2018
package.json Update bsb-native package version Aug 8, 2018
yarn.lock react hooks Mar 13, 2019

README.md

Official ReasonReact Migration Script

ReasonReact breaking change releases, if any, are accompanied by this upgrade script and a description of changes here.

Installation

Don't forget to upgrade your reason-react dependency first!

Pick the right version of the migration script based on the version of ReasonReact your app is using:

  • Upgrading from reason-react 0.3.0 to 0.3.1: npm install https://github.com/chenglou/upgrade-reason-react\#0.3.0-to-0.3.1
  • Upgrading from reason-react 0.3.1 to 0.4.0: npm install https://github.com/chenglou/upgrade-reason-react\#0.3.1-to-0.4.0
  • Upgrading from reason-react 0.4.2 to 0.5.0: npm install https://github.com/chenglou/upgrade-reason-react\#0.4.2-to-0.5.0
  • Upgrading from reason-react 0.6.0 to 0.7.0: npm install https://github.com/chenglou/upgrade-reason-react\#0.6.0-to-0.7.0

and so on. See the releases page for all the scripts.

Notes:

  • If you're e.g. currently on reason-react 0.3.2, you can still use the #0.3.1-to-0.4.0 script, as there has been no breaking changes in-between reason-react 0.3.1 and 0.4.0.
  • You can chain the upgrade scripts one after another to upgrade a really old ReasonReact app onto the newest one; but you can't do it automatically. Some scripts might require some human clean-ups after being run.

Usage

./node_modules/upgrade-reason-react/lib/bs/bytecode/migrate.byte MyComponent1.re

Where MyComponent1.re is the file you want to upgrade. You can also pass a glob, e.g. src/*.re, to upgrade multiple files at once.

npm uninstall upgrade-reason-react after you're done.

Development

If you're interested in contributing to this library, clone this repo and do yarn && yarn start to start the watcher.

For seeing a Reason file's AST, do ocamlc -pp "refmt --print binary" -dparsetree -impl test/component.re (assuming you have ocamlc and refmt somewhere).

Make the desired changes in src/migrate.re, then run ./lib/bs/bytecode/migrate.byte test/component.re to test the modification of component.re by your migrate script.

You can’t perform that action at this time.