Skip to content

Commit a1b896f

Browse files
authored
[bsb] Tweak react hooks template README (#3974)
1 parent 678cf3d commit a1b896f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

jscomp/bsb/templates/react-hooks/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ Open a new web page to `http://localhost:8000/`. Change any `.re` file in `src`
2222

2323
**How come we don't need any bundler during development**? We highly encourage you to open up `index.html` to check for yourself!
2424

25-
If you start handling routes via `ReasonReactRouter` change the server script in package.json to `moduleserve ./ --port 8000 --spa` to make sure your routes don't result in a 404 not found error. With the added `--spa` flag your routes will return the index.html on page load and you can handle them client-side.
26-
2725
# Features Used
2826

2927
| | Blinking Greeting | Reducer from ReactJS Docs | Fetch Dog Pictures | Reason Using JS Using Reason |
@@ -55,3 +53,9 @@ mv UNUSED_webpack.config.js webpack.config.js
5553
./node_modules/.bin/webpack
5654
open indexProduction.html
5755
```
56+
57+
# Handle Routing Yourself
58+
59+
To serve the files, this template uses a minimal dependency called `moduleserve`. A URL such as `localhost:8000/scores/john` resolves to the file `scores/john.html`. If you'd like to override this and handle URL resolution yourself, change the `server` command in `package.json` from `moduleserve ./ --port 8000` to `moduleserve ./ --port 8000 --spa` (for "single page application"). This will make `moduleserve` serve the default `index.html` for any URL. Since `index.html` loads `Index.bs.js`, you can grab hold of the URL in the corresponding `Index.re` and do whatever you want.
60+
61+
By the way, ReasonReact comes with a small [router](https://reasonml.github.io/reason-react/docs/en/router) you might be interested in.

0 commit comments

Comments
 (0)