我正在尝试使用 Typescript 和 Storybook 制作一个简单的 React 组件库来获得乐趣,我的第一个愚蠢的Button组件似乎可以工作。我有另一个 CRA 演示应用程序,我正在作为最终用户尝试该库。
但我遇到了一件事:我无法使prop-types我的Button组件在演示应用程序中工作。它只是不打印警告。
库的文件和文件夹当前组织如下:
src/
index.ts
controls/
index.ts
Button.tsx
babelconfig.js
tsconfig.ts
webpack.config.js
(+ other configuration files and folder for jest and storybook)
Run Code Online (Sandbox Code Playgroud)
我有一个src/index.ts文件,它是我的库的入口点,它只导出来自该controls文件夹的所有内容。
src/
index.ts
controls/
index.ts
Button.tsx
babelconfig.js
tsconfig.ts
webpack.config.js
(+ other configuration files and folder for jest and storybook)
Run Code Online (Sandbox Code Playgroud)
在我的src/controls文件夹中,有一个index.ts文件可以导出Button组件中的所有内容。
// src/index.ts
export * from './controls'
Run Code Online (Sandbox Code Playgroud)
Button目前,该组件非常简单:
// src/controls/index.ts
export * from './Button' …Run Code Online (Sandbox Code Playgroud) 我有一个 WooCommerce 网站,我的一位客户在该网站上购买了产品和电缆。
该客户购买了一条与其他产品不兼容的电缆,并询问我们是否可以向他运送价格相同的兼容电缆。
也许这是一个愚蠢的问题,但是我如何编辑已经付款的订单,移除不兼容的电缆并添加正确的产品?
有可能吗?我需要插件还是什么?
提前谢谢你,卢卡
我有一个带有 ServiceWorker 的 React 应用程序,其目的是拦截某些请求(API 调用和资源获取)并添加Authorization带有适当令牌的标头。在大多数情况下,它工作得很好,但在某些情况下,Service Worker 不会处理 fetch 事件,从而导致 401 响应。
反应侧\xe2\x9a\x9b\xef\xb8\x8f
\n我们有以下函数来注册 Service Worker 并等待它激活:
\nfunction initializeServiceWorker() {\n return new Promise((resolve, reject) => {\n navigator\n .serviceWorker\n .register("/tom.js")\n .then((registration) => {\n\n // checks the state of the service worker until it\'s activated\n // and move on with the then-chain\n return pollUntil(\n (registration) => registration.active?.state === "activated",\n POLL_EVERY, // 40ms\n registration,\n POLL_TIMEOUT // 6000ms\n );\n\n })\n .then((registration) => {\n\n // here we send …Run Code Online (Sandbox Code Playgroud)