2017-08-27 22:13:35 +02:00
# Example app using ReasonML & ReasonReact components
2020-01-16 23:23:56 +01:00
This example features:
- An app that mixes together JavaScript and ReasonML components and functions
- An app with two pages which has a common Counter component
- That Counter component maintain the counter inside its module. This is used
primarily to illustrate that modules get initialized once and their state
variables persist in runtime
2019-11-27 17:40:58 +01:00
## Deploy your own
2021-01-19 08:28:54 +01:00
Deploy the example using [Vercel ](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example ):
2019-11-27 17:40:58 +01:00
2021-01-07 02:40:29 +01:00
[![Deploy with Vercel ](https://vercel.com/button )](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-reasonml& project-name=with-reasonml& repository-name=with-reasonml)
2019-11-27 17:40:58 +01:00
2017-08-27 22:13:35 +02:00
## How to use
2020-05-27 23:51:11 +02:00
Execute [`create-next-app` ](https://github.com/vercel/next.js/tree/canary/packages/create-next-app ) with [npm ](https://docs.npmjs.com/cli/init ) or [Yarn ](https://yarnpkg.com/lang/en/docs/cli/create/ ) to bootstrap the example:
2017-12-03 05:30:17 +01:00
2018-03-14 09:09:46 +01:00
```bash
2020-06-01 19:36:57 +02:00
npx create-next-app --example with-reasonml with-reasonml-app
2018-03-14 09:09:46 +01:00
# or
yarn create next-app --example with-reasonml with-reasonml-app
2017-12-03 05:30:17 +01:00
```
2021-01-07 02:40:29 +01:00
Deploy it to the cloud with [Vercel ](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example ) ([Documentation](https://nextjs.org/docs/deployment)).
2018-04-03 14:19:05 +02:00
2017-09-30 22:02:45 +02:00
### Recommendation:
Run BuckleScript build system `bsb -w` and `next -w` separately. For the sake
of simple convention, `npm run dev` run both `bsb` and `next` concurrently.
However, this doesn't offer the full [colorful and very, very, veeeery nice
error
2018-02-06 15:22:32 +01:00
output](https://reasonml.github.io/blog/2017/08/25/way-nicer-error-messages.html)
2017-09-30 22:02:45 +02:00
experience that ReasonML can offer, don't miss it!
2017-08-27 22:13:35 +02:00
2019-04-19 22:28:28 +02:00
There are 2 convenience scripts to facilitate running these separate processes:
1. `npm run dev:reason` - This script will start the ReasonML toolchain in
watch mode to re-compile whenever you make changes.
2. `npm run dev:next` - This script will start the next.js development server
so that you will be able to access your site at the location output by the
script. This will also hot reload as you make changes.
You should start the scripts in the presented order.