Skip to content

Commit 9091610

Browse files
committed
Make the advanced usage notes nicer
1 parent ec9bbe2 commit 9091610

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

readme.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ function setupPorts(ports) {
6464
In the `setupPorts` function, we first subscribe to the `numActiveTodos` port. Whenever the number of active todos changes, we will run that function and log the number on the console. After that, we send two values through the `todos` port. This will add both of these into the model *and* trigger the `numActiveTodos` callback twice.
6565

6666

67-
### Notes
68-
69-
Once the properties are initialized, they will never be used again. Changing `flags` or `ports` will do nothing. So here are two tricks that may help you out:
70-
71-
- If you want to reinitialize your Elm component, add a different `key` to the old and new components. This way old one is destroyed and replaced by the new one.
72-
73-
- If you want to change your ports, you should save the `ports` object into your `state` so you can mess with it later.
74-
75-
7667
# Example
7768

7869
[**Demo**](http://evancz.github.io/react-elm) / [**Code**](example)
@@ -93,3 +84,13 @@ setupPorts(app.ports)
9384
```
9485

9586
So if you are interested in embedding Elm in something else, do the same trick! You can get more complete docs on embedding Elm in HTML [here](http://guide.elm-lang.org/interop/html.html) and JavaScript interop [here](http://guide.elm-lang.org/interop/javascript.html). Let the community know if you make something!
87+
88+
89+
# Advanced Usage
90+
91+
Once the Elm component is initialized, changing the `flags` and `ports` properties will do nothing. So here are some tricks that may help you out:
92+
93+
1. If you want to reinitialize your Elm component, add a different `key` to the old and new components. This way old one is destroyed and replaced by the new one.
94+
2. If you want to mess with ports, you can save the `ports` object into your `state` and access it later.
95+
3. This package is super simple. Fewer than 20 lines. Check out the implementation and do it different if you want!
96+

0 commit comments

Comments
 (0)