Skip to content

Instantly share code, notes, and snippets.

@Chanutg
Created April 12, 2019 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chanutg/7b0eb0ab9ab234d863d797b9e5920afb to your computer and use it in GitHub Desktop.
Save Chanutg/7b0eb0ab9ab234d863d797b9e5920afb to your computer and use it in GitHub Desktop.
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