As soon as you
installed ReScript React Native properly
and have you
./bsconfig.json ready, you can create two
./App.js: a proxy for React Native to reference ReScript compiled app component
./src/App.re: the actual React Native entry point, using Reason
If you used our template as explained in the installation guide, you should already have these files.
No worries, you can copy paste this if needed without understanding the content for now. Documentation will explain everything 😇.
a proxy to
App.res application wrapper.
Please directly grab the App.res of our template, which will match React Native default Hello World!
- Modules are not imported, but opened instead (without reference to the filesystem file) and this is due to how modules work in ReScript (filename must be unique),
- Component definition must be preceded with
constis not a thing in Reason, &
letis the default as ReScript have a specific way to allow mutable variables,
- String in JSX must be quoted and explicitely referenced as
React.string(you will find similar specific
React.*to specify null value (
React.null), children from an array
- References to
- You won't see any explicit
Now let's run this example.
In comparison with standard React Native development, the only thing you need to
be sure that you have successfully compiled
App.bs.js like we
explained in the usage section.
As soon as ReScript compilation is successful, nothing should change for your
development process. You can normally start your React Native app via
react-native run-android or your classic web workflow
if you use