React钩子动态加载外部脚本并知道何时加载

时间:2021-06-08 14:51:44
【文件属性】:
文件名称:React钩子动态加载外部脚本并知道何时加载
文件大小:78KB
文件格式:ZIP
更新时间:2021-06-08 14:51:44
Awesome React Hooks react-script-hook React hook 动态加载外部脚本并知道它何时加载 安装 // 使用 npm npm install react-script-hook // 使用 yarn yarn 添加 react-script-hook 如何使用 import React from 'react' ; 从'react-stripe-elements'导入{StripeProvider}; 从 'react-script-hook' 导入 useScript; 从'./my-checkout'导入MyCheckout; function App() { const [loading, error] = useScript({ src: 'https://js.stripe.com/v3/' }); 如果(加载)返回
【文件预览】:
react-script-hook-master
----.gitignore(927B)
----package.json(2KB)
----package-lock.json(314KB)
----src()
--------__tests__()
--------index.tsx(53B)
--------use-script.tsx(2KB)
----jest.config.js(204B)
----LICENSE(1KB)
----tsconfig.json(767B)
----.github()
--------workflows()
----.eslintrc.js(96B)
----.prettierrc.js(119B)
----README.md(2KB)
----.eslintignore(34B)
----.vscode()
--------settings.json(313B)

网友评论