diff --git a/src/components/App/index.js b/src/components/App/index.js index e201f78..9b4109d 100644 --- a/src/components/App/index.js +++ b/src/components/App/index.js @@ -76,11 +76,13 @@ const createPngLink = async ({ svg, width, height }) => { }; class App extends React.PureComponent { - state={ - ...readURLHash() - } + state={} componentDidMount() { + // Gatsby doesn't have document.location, so readURLHash can't be called + // until here + this.setState(readURLHash()); + window.addEventListener('hashchange', this.handleHashChange); this.handleHashChange(); } @@ -144,7 +146,7 @@ class App extends React.PureComponent { }; return -
+ { syntax && }