Skip to content

Commit ec9bbe2

Browse files
committed
Consolidate notes into one place
1 parent 097b136 commit ec9bbe2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

readme.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ function render() {
3636

3737
These flags will be given to the Elm program, allowing you to do some setup work in JS first.
3838

39-
**Note:** Once `flags` has been used to initialize the component, it will never be used again. Changing this property will have no effect. If you want to reinitialize your Elm component, you can add a different `key` to the old and new components so the old one is destroyed and replaced by the new one.
40-
4139

4240
### JavaScript/Elm Interop
4341

@@ -65,7 +63,14 @@ function setupPorts(ports) {
6563

6664
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.
6765

68-
**Note:** Once the `ports` function has been used to initialize the component, it will never be used again. Providing a new function does nothing. If you want to change your ports, you should save the `ports` object into your `state` so you can mess with it later.
66+
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.
6974

7075

7176
# Example

0 commit comments

Comments
 (0)