react-r2d2
Advanced tools
+1
-1
| { | ||
| "name": "react-r2d2", | ||
| "version": "0.4.0", | ||
| "version": "0.4.1", | ||
| "description": "HOC for dispatching an action automatically on component render", | ||
@@ -5,0 +5,0 @@ "keywords": ["react", "higher", "order", "component", "redux", "dispatch", "store"], |
+7
-5
@@ -63,2 +63,3 @@ <img src="https://i.imgur.com/LXTmHwZ.jpg" width="200px"> | ||
| import React, { Component } from 'react'; | ||
| import WrappedComponent from './Component'; | ||
@@ -69,7 +70,8 @@ | ||
| // If the store is not able to be validated, this component will be rendered as altComponent. | ||
| const Loading = () => <div>Loading...</div>; | ||
| class Container extends Component { | ||
| // If the store is not able to be validated, this component will be rendered as altComponent. | ||
| loadingComponent = () => <div>Loading...</div>; | ||
| state = {} | ||
| render() { | ||
@@ -82,3 +84,3 @@ return ( | ||
| {/* v Optional v */} | ||
| altComponent={this.loadingComponent} | ||
| altComponent={Loading} | ||
| validateStore={state => state.id !== undefined} | ||
@@ -85,0 +87,0 @@ /> |
101
2.02%29307
-0.02%