We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b07bab commit 71fd64eCopy full SHA for 71fd64e
chapter9-1/src/App.js
@@ -27,6 +27,20 @@ const ColorList = ({store}) => {
27
28
29
class App extends Component {
30
+ getChildContext() {
31
+ return {
32
+ store : this.props.store
33
+ }
34
35
+
36
+ componentWillMount() {
37
+ this.unsubscribe = store.subscribe(()=>this.forceUpdate())
38
39
40
+ componentWillUnmount() {
41
+ this.unsubscribe();
42
43
44
constructor(props) {
45
super(props)
46
this.state = {
@@ -82,4 +96,8 @@ class App extends Component {
82
96
}
83
97
84
98
99
100
+App.childContextTypes = {
101
+ store : PropTypes.object.isRequired
102
+}
85
103
export default App;
0 commit comments