From 253e7a73c43e61abc0f5ba63435b654614ff80da Mon Sep 17 00:00:00 2001 From: lbaker Date: Thu, 25 Mar 2021 15:08:35 -0700 Subject: [PATCH] fix: Add gatsby's react to the window instead of importing from nr-assets --- gatsby-browser.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gatsby-browser.js b/gatsby-browser.js index 54dca922a..d3534a79d 100644 --- a/gatsby-browser.js +++ b/gatsby-browser.js @@ -69,4 +69,11 @@ const onRouteUpdate = ({ location }) => { return null; }; -export { onRouteUpdate, wrapPageElement, onInitialClientRender }; + +const onClientEntry = () => { + // Expose both globals so that the NR1 docs can read it. + window.React = require('react'); + window.ReactDOM = require('react-dom'); +}; + +export { onRouteUpdate, wrapPageElement, onInitialClientRender, onClientEntry };