UNPKG

1.21 kBMarkdownView Raw
1# Client
2Client-side intialization code.
3
4- **Why?** — For the same reasons we have the standard
5 [server setup](./server.md).
6
7This module exports a single **`Launch(options)`** function that starts the app
8at the client side. It renders the app, wraps it with
9[`react-router`](https://www.npmjs.com/package/react-router)'s `<BrowserRouter>`,
10and Redux store `<Provider>`, if necessary; then injects it into the page HTML
11template generated by the server. In the case of use with development server,
12it 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`** &mdash; *Function* &mdash; The root ReactJS component of
16 the app to be rendered.
17- **`storeFactory`** &mdash; *Function* &mdash; 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`** &mdash; *Object* &mdash; 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.