Created
April 12, 2019 14:12
-
-
Save Chanutg/7b0eb0ab9ab234d863d797b9e5920afb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import HelloWorld from "./HelloWorld"; | |
class App extends Component { | |
state = { loading: true, drizzleState: null }; | |
componentDidMount() { | |
const { drizzle } = this.props; | |
this.unsubscribe = drizzle.store.subscribe(() => { | |
const drizzleState = drizzle.store.getState(); | |
if (drizzleState.drizzleStatus.initialized) { | |
this.setState({ loading: false, drizzleState }); | |
} | |
}); | |
} | |
render() { | |
if (this.state.loading) return "Loading Drizzle..."; | |
return ( | |
<div className="App"> | |
<HelloWorld | |
drizzle={this.props.drizzle} | |
drizzleState={this.state.drizzleState} | |
/> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment