Permalink
Browse files

`@phenomic/plugin-renderer-react`: add render + callback option to …

…createApp/renderApp for custom rendering
  • Loading branch information...
MoOx committed Apr 11, 2018
1 parent 1b89077 commit ce083d92f7abced22dbc8a2884649a92f47cdf41
Showing with 13 additions and 4 deletions.
  1. +13 −4 packages/plugin-renderer-react/src/createApp.js
@@ -16,7 +16,11 @@ const render =
let store;
export const renderApp = (routes: () => React.Element<any>) => {
export const renderApp = (
routes: () => React.Element<any>,
render: Function = render,
callback?: () => void
) => {
debug("client rendering");
const initialStateNode = document.getElementById("PhenomicHydration");
@@ -42,13 +46,18 @@ export const renderApp = (routes: () => React.Element<any>) => {
<AppContainer>
<Provider store={store}>{routes()}</Provider>
</AppContainer>,
root
root,
callback
);
};
export default (routes: () => React.Element<any>): PhenomicAppType => {
export default (
routes: () => React.Element<any>,
render?: Function,
callback?: () => void
): PhenomicAppType => {
if (typeof window !== "undefined") {
renderApp(routes);
renderApp(routes, render, callback);
}
return {
routes: routes()

0 comments on commit ce083d9

Please sign in to comment.