简体   繁体   中英

React Stytch has not been loaded

Recently I get to implement Stytch to a React based application. Implementation is pretty simple and strait forward. However got into an error or bug which become a big road block for me.

I tried Googling to find solution, if not even I find similar so that I can debug myself but unfortunately didn't find any. And the big surprise if Stytch GitHub repo link provided on NPM is invalid too.

The problem I'm facing is, it says:

Stytch has not been loaded.
Make sure the script tag exists in the document head:

<script src="https://js.stytch.com/stytch.js"></script>

If using Next.js be sure to load Stytch using the beforeInteractive strategy in pages/_app.jsx:

import Script from 'next/script';

<Script src="https://js.stytch.com/stytch.js" strategy="beforeInteractive" />

I'm following the Stytch doc here: https://stytch.com/docs/sdks/javascript-sdk/email-magic-links/methods

And created a Sample app here: https://codesandbox.io/s/react-stytch-login-auth-xmf5r4

here is the link just install @stytch/stytch-react using npm.

in the code box you can add through dependencies tab. just make sure you include the script tag in the public/index.html .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM