Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

Commit

Permalink
feat: add's new client entry point
Browse files Browse the repository at this point in the history
use `import { render, wrapRootEpic } from 'react-redux-epic/client';` on the client side to prevent
bundling unnecessary files
  • Loading branch information
Berkeley Martinez authored and Berkeley Martinez committed Mar 12, 2017
1 parent adaf4ed commit 996245b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
render: require('./lib/render.js').default,
wrapRootEpic: function(f) { return f; }
};
6 changes: 3 additions & 3 deletions src/render.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ReactDOM from 'react-dom';
import { render as _render, unmountComponentAtNode } from 'react-dom';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';

Expand All @@ -10,15 +10,15 @@ import { Subscription } from 'rxjs/Subscription';
export default function render(Component, DOMContainer) {
return Observable.create(observer => {
try {
ReactDOM.render(Component, DOMContainer, function() {
_render(Component, DOMContainer, function() {
observer.next(this);
});
} catch (e) {
return observer.error(e);
}

return new Subscription(() => {
return ReactDOM.unmountComponentAtNode(DOMContainer);
return unmountComponentAtNode(DOMContainer);
});
});
}

0 comments on commit 996245b

Please sign in to comment.