(state)
| 42 | } |
| 43 | |
| 44 | function render(state) { |
| 45 | Router.dispatch(state, (_, component) => { |
| 46 | ReactDOM.render(component, container, () => { |
| 47 | // Restore the scroll position if it was saved into the state |
| 48 | if (state.scrollY !== undefined) { |
| 49 | window.scrollTo(state.scrollX, state.scrollY); |
| 50 | } else { |
| 51 | window.scrollTo(0, 0); |
| 52 | } |
| 53 | cleanUp(); |
| 54 | }); |
| 55 | }); |
| 56 | } |
| 57 | |
| 58 | function run() { |
| 59 | let currentLocation = null; |