简体   繁体   English

React Stytch 尚未加载

[英]React Stytch has not been loaded

Recently I get to implement Stytch to a React based application.最近我开始为基于 React 的应用程序实现 Stytch。 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.如果 NPM 上提供的 Stytch GitHub 存储库链接也无效,这将是一个很大的惊喜。

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我在这里关注 Stytch 文档: 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并在这里创建了一个示例应用程序: https ://codesandbox.io/s/react-stytch-login-auth-xmf5r4

here is the link just install @stytch/stytch-react using npm.这是使用 npm 安装@stytch/stytch-react链接

in the code box you can add through dependencies tab.在代码框中,您可以通过依赖项选项卡添加。 just make sure you include the script tag in the public/index.html .只需确保在public/index.html中包含script标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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