1 | # Client
|
2 | Client-side intialization code.
|
3 |
|
4 | - **Why?** — For the same reasons we have the standard
|
5 | [server setup](./server.md).
|
6 |
|
7 | This module exports a single **`Launch(options)`** function that starts the app
|
8 | at the client side. It renders the app, wraps it with
|
9 | [`react-router`](https://www.npmjs.com/package/react-router)'s `<BrowserRouter>`,
|
10 | and Redux store `<Provider>`, if necessary; then injects it into the page HTML
|
11 | template generated by the server. In the case of use with development server,
|
12 | it also takes care about HMR (Hot Module Reloading) setup at the clients-side.
|
13 |
|
14 | **`options`** should be a JS object, with the following fields:
|
15 | - **`Application`** — *Function* — The root ReactJS component of
|
16 | the app to be rendered.
|
17 | - **`storeFactory`** — *Function* — Optional. Redux store factory.
|
18 | If provided, it will be used to generate Redux store that will be provided to
|
19 | the app. Its signature should be:
|
20 |
|
21 | **Arguments**
|
22 | - **`initialState`** — *Object* — Initial Redux state, injected by
|
23 | the server (will be `undefined`, if it is not generated by the current
|
24 | server setup).
|
25 |
|
26 | **Returns**
|
27 | - *Promise* that resolves to the created Redux store.
|