* Get DOM element where app will mount.
()
| 51 | * Get DOM element where app will mount. |
| 52 | */ |
| 53 | function getRoot() { |
| 54 | /** |
| 55 | * Return existing root if found. |
| 56 | */ |
| 57 | const existingRoot = document.getElementById(ROOT_ID); |
| 58 | if (existingRoot) { |
| 59 | return existingRoot; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * If no existing root, create and return a new root. |
| 64 | */ |
| 65 | const newRoot = document.createElement('div'); |
| 66 | newRoot.id = ROOT_ID; |
| 67 | document.body.appendChild(newRoot); |
| 68 | return newRoot; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Dispatch config to store if received. This config will be merged into |