Skip to content

Commit eba9ebe

Browse files
authored
Merge v3-beta into master (vercel#2809)
* Add examples/with-redux-code-splitting. (vercel#2721) * vercel#1757 Relay Modern Example (vercel#2696) * Add ReasonML example (vercel#2640) * Add ReasonML example * Add a gitignore specifically for the reasonml example * Allow custom className for <Main /> (vercel#2802) * 3.0.2 * Remove beta information from the README. * 3.0.3 * Remove unnecessary lookup in example with emotion (vercel#2731) * Document SCSS/Less (vercel#2742) * Document SCSS/Less * Add missing word * Add docs for examples dir * Add extra example * uppercase J * Add with pkg example (vercel#2751) * Add custom server micro example (vercel#2750) * Ease running multiple examples at the same time with process.env.PORT (vercel#2753) * Add line-height rule for error page h2 (vercel#2761) * Add support for fetching multiple translation files (vercel#2743) * Add support for fetching multiple translation files * Cleanup * Clear missed interval (vercel#2611) * clear missed interval * remove trailing whitespace * Relay Modern Example (vercel#1757) (vercel#2773) * Simplification of Relay Modern Example (vercel#1757) (vercel#2776) * Use deterministic names for dynamic import (vercel#2788) * Always use the same name for the same dynamic import. * Add unit tests for the modulePath generation. * Allow tests to run correctly on Windows. * Make the chunk name a bit pretty. * Fix tests to run on Windows. * 3.0.4 * Revert "Make the chunk name a bit pretty." (vercel#2792) This reverts commit 0c9e8cf. * 3.0.5 * Use _ as the divider for dynamic import name splitter. (vercel#2793) Using - gives us some weird webpack errors. * 3.0.6 * next/dynamic Error Message Tweaks (vercel#2798) * Fixed issue (vercel#2804) vercel#2800 * docs(material-ui): move the source code to Material-UI repository (vercel#2808)
1 parent b543795 commit eba9ebe

26 files changed

Lines changed: 408 additions & 3 deletions

File tree

examples/with-reasonml/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bs
2+
.merlin

examples/with-reasonml/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-reasonml)
2+
# Example app using ReasonML & ReasonReact components
3+
4+
## How to use
5+
6+
Download the example [or clone the repo](https://github.com/zeit/next.js):
7+
8+
```bash
9+
curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/with-reasonml
10+
cd with-reasonml
11+
```
12+
13+
Install it and run:
14+
15+
```bash
16+
npm install
17+
npm run dev
18+
```
19+
20+
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
21+
22+
```bash
23+
now
24+
```
25+
26+
## The idea behind the example
27+
28+
This example features:
29+
30+
* An app that mixes together JavaScript and ReasonML components and functions
31+
* An app with two pages which has a common Counter component
32+
* 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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "with-reasonml",
3+
"sources": ["components", "pages"],
4+
"bs-dependencies": ["reason-react"],
5+
"reason": { "react-jsx": 2 },
6+
"package-specs": ["commonjs"]
7+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let component = ReasonReact.statefulComponent "Counter";
2+
let make _children => {
3+
...component,
4+
initialState: fun () => 0,
5+
render: fun self => {
6+
let countMsg = "Count: " ^ (string_of_int self.state);
7+
let onClick _evt {ReasonReact.state} => ReasonReact.Update (state + 1);
8+
9+
<div>
10+
<p> (ReasonReact.stringToElement countMsg) </p>
11+
<button onClick=(self.update onClick)> (ReasonReact.stringToElement "Add") </button>
12+
</div>
13+
}
14+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
let component = ReasonReact.statelessComponent "Header";
2+
let styles = ReactDOMRe.Style.make
3+
marginRight::"10px"
4+
();
5+
let make _children => {
6+
...component,
7+
render: fun _self => {
8+
<div>
9+
<a href="/" style=styles> (ReasonReact.stringToElement "Home") </a>
10+
<a href="/about" style=styles> (ReasonReact.stringToElement "About") </a>
11+
</div>
12+
}
13+
};

examples/with-reasonml/index.js

Whitespace-only changes.

examples/with-reasonml/lib/js/components/counter.js

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/with-reasonml/lib/js/components/header.js

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/with-reasonml/lib/js/components/link.js

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/with-reasonml/lib/js/pages/about.js

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)