Skip to content

Commit d8103a4

Browse files
committed
Website: update docs (intro & install)
1 parent bab7ecb commit d8103a4

File tree

2 files changed

+119
-1
lines changed

2 files changed

+119
-1
lines changed

website/docs/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,18 @@ introduce an additional cost. The JavaScript code produced by BuckleScript will
4949
directly hit React & React Native JavaScript implementation, without any extra
5050
runtime & bundle cost.
5151

52+
## Using Reason & Reason React
53+
54+
_Reason React Native_ is a package that works with
55+
[Reason](https://reasonml.github.io/) & use
56+
[Reason React](https://reasonml.github.io/reason-react/). For this reasons (!),
57+
if you are unfamiliar on of this two, we encourage you to have a look to their
58+
documentations as soon as you don't find an answer you might have here.
59+
60+
And one day or another, you will also have to look for answers on
61+
[BuckleScript](https://bucklescript.github.io/docs/en/what-why), our
62+
Reason-to-JavaScript compiler.
63+
5264
---
5365

5466
## Further reading

website/docs/install.md

Lines changed: 107 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,113 @@ id: install
33
title: Installation
44
---
55

6-
@todo
6+
Depending on how you want to start with _Reason React Native_, you have
7+
different options to install it:
8+
9+
- [Create a new project with _Reason React Native_](#create-a-new-project-with-reason-react-native)
10+
- [Add _Reason React Native_ to an existing project](#add-reason-react-native-to-an-existing-project)
11+
- [Migrating from `bs-react-native` to _Reason React Native_](/reason-react-native/en/docs/migration/jsx3/)
12+
13+
All options will basically help you to have :
14+
15+
- [BuckleScript](https://bucklescript.github.io/) (`bs-platform` - includes
16+
[ReasonML](https://reasonml.github.io)!)
17+
- [Reason React](https://reasonml.github.io/reason-react/) (`reason-react`)
18+
- _Reason React Native_ (`reason-react-native`)
19+
20+
Below we assume you are already familiar with React Native. If you are new to
21+
React Native, please have a quick look to
22+
[React Native Getting Started documentation](https://facebook.github.io/react-native/docs/getting-started.html)
23+
in order to get the minimal requirements.
24+
25+
## Create a new project with _Reason React Native_
26+
27+
React Native allows to create new project from a template, so we made one. By
28+
choosing this option you will get an hello world project that will already have
29+
all the requirements included.
30+
31+
```console
32+
react-native init MyApp --template reason
33+
```
34+
35+
💖 Now that you project is setup, you can just check
36+
[how to use _Reason React Native_](#using-reason-react-native) right away!
37+
38+
---
39+
40+
⚠️ We don't provide yet instructions for _Expo_ users. _If you are familiar with
41+
Expo, feel free to open
42+
[an issue](https://github.com/reasonml-community/reason-react-native/issues/new?title=Expo+template)
43+
so we can discuss about that_.
44+
45+
## Add _Reason React Native_ to an existing project
46+
47+
If you already have an existing project, it's really fast to get all the thing
48+
you need to start using Reason React Native right away!
49+
50+
Got into your project root & then install the requirements
51+
52+
```console
53+
yarn add bs-platform --dev
54+
yarn add reason-react reason-react-native
55+
```
56+
57+
Then create a file named `bsconfig.json` at the same level at your
58+
`package.json` with the following content
59+
60+
```json
61+
{
62+
"name": "my-reason-react-native-app",
63+
"refmt": 3,
64+
"reason": {
65+
"react-jsx": 3
66+
},
67+
"package-specs": {
68+
"module": "es6",
69+
"in-source": true
70+
},
71+
"suffix": ".bs.js",
72+
"sources": [
73+
{
74+
"dir": "src",
75+
"subdirs": true
76+
}
77+
],
78+
"bs-dependencies": ["reason-react", "reason-react-native"]
79+
}
80+
```
81+
82+
👀 _For details about this file, please refer to
83+
[BuckleScript Configuration documentation](https://bucklescript.github.io/docs/en/build-configuration)._
84+
85+
When it's done, you are ready to use Reason React Native !
86+
87+
---
88+
89+
## Using Reason React Native
90+
91+
@todo move here
92+
[what's in the template readme](https://github.com/reasonml-community/reason-react-native/tree/master/react-native-template-reason#react-native-helloworld)
93+
94+
### Using JavaScript components from Reason
95+
96+
@todo check out
97+
[Reason React interop page](https://reasonml.github.io/reason-react/docs/en/components#interop).
98+
99+
You can also browse the source of
100+
[reason-react-native](https://github.com/reasonml-community/reason-react-native/tree/master/reason-react-native/src)
101+
because that's exactly what this project is doing!
102+
103+
### Using Reason React Native components from JavaScript
104+
105+
@todo Meanwhile, check out
106+
[Reason React interop page](https://reasonml.github.io/reason-react/docs/en/components#interop)
107+
108+
---
109+
110+
👉 At this step, you should check our in-depth
111+
[Example](/reason-react-native/en/docs/example/) or our
112+
[Cheatsheet](/reason-react-native/en/docs/cheatsheet/)
7113

8114
---
9115

0 commit comments

Comments
 (0)