(let [pos (subscribe [:current-position])] ;; obtain the data
(fn []
[gmap-inner @pos])))
```
Notes:
-`gmap-outer` obtains data via a subscription. It is quite simple - trivial almost.
- it then passes this data __as a prop__ to `gmap-inner`. This inner component has the job of wrapping/managing the stateful js component (Gmap in our case above)
- when the data (delivered by the subscription) to the outer layer changes, the inner layer, `gmap-inner`, will be given a new prop - `@pos` in the case above.
- when the inner component is given new props, its entire set of lifecycle functions will be engaged.
- the renderer for the inner layer ALWAYS renders the same, minimal container hiccup for the component. Even though the `props` have changed, the same hiccup is output. So it will appear to React as if nothing changes from one render to the next. No work to be done. React/Reagent will leave the DOM untouched.
- but this inner component has other lifecycle functions and this is where the real work is done.
- for example, after the renderer is called (which ignores its props), `component-did-update` will be called. In this function, we don't ignore the props, and we use them to update/mutate the stateful JS component.
- the props passed (in this case `@pos`) in must be a map, otherwise `(reagent/props comp)` will return nil.
### Pattern Discovery
This pattern has been independently discovered by many. To my knowledge,
[this description of the Container/Component pattern](https://medium.com/@learnreact/container-components-c0e67432e005#.3ic1uipvu)
is the first time it was written up.
### Code Credit
The example gmaps code above was developed by @jhchabran in this gist: