blob: 365a037dd4fe4b9697eb6e95fed1b56b9c725de8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
const React = require('react');
const Helmet = require('react-helmet');
const ReactRedux = require('react-redux');
const { InjectedComponent } = require('./components/InjectedComponent');
/**
* Render a registered component from a store.
* This method is intended for server-side use in "gitbook".
*
* @param {ReduxStore} store
* @param {Descriptor} matching
* @return {Object} { el, meta }
*/
function renderComponent(store, matching) {
const el = (
<ReactRedux.Provider store={store}>
<InjectedComponent matching={matching} />
</ReactRedux.Provider>
);
const head = Helmet.rewind();
return { el, head };
}
module.exports = renderComponent;
|