![](/img/trans.png)
[英]'[Symbol.iterator]()' method that returns an iterator
使用嚴格模式時,我在代碼中遇到了這個錯誤,但我沒有管理它。 它發生在這行代碼中: 此服務方法返回 MyType 列表的可觀察對象: 這個 MyType 是非常簡單的界面: 我該如何解決? ...
[英]'[Symbol.iterator]()' method that returns an iterator
使用嚴格模式時,我在代碼中遇到了這個錯誤,但我沒有管理它。 它發生在這行代碼中: 此服務方法返回 MyType 列表的可觀察對象: 這個 MyType 是非常簡單的界面: 我該如何解決? ...
[英]Using React Strict mode with random numbers
我正在嘗試使用 React 創建一個帶有 AI 的井字游戲。 我有一個 function 用於我的 AI,它重新調整隨機行和列以放置一塊。但是,當使用嚴格模式時,AI 需要兩輪,因為隨機數會再次生成。 從我所做的閱讀來看,這表明我正在錯誤地更新我的主板 state,但我不確定我哪里出錯了。 下面是我 ...
[英]How to detect if code runs in browser in TypeScript?
我將 ES5 JavaScript 代碼重寫為 TypeScript 並具有如下代碼:var is_browser = (function() { try { return this === window; } catch (e) { return ...
[英]React Strict Mode executing setState Twice breaking code
我的應用程序有一個購物車功能,每次用戶點擊添加按鈕時,商品的數量都會增加。 我有下面鏈接的代碼框。 https://codesandbox.io/s/multiple-state-exec-trv72o 首次將餐點添加到購物車時,該功能會根據需要運行。 當我在同一頓飯上第二次添加 hit add ...
[英]findDOMNode is deprecated
賞金將在 2 天內到期。 此問題的答案有資格獲得+50聲望賞金。 保羅正在尋找一個規范的答案: 我想在我的項目中擺脫這些警告。 如果您需要任何其他信息,請告訴我在我的網站(用 React 編寫)上,我使用日歷,以便用戶可以 select 日期和時間范圍。 為此,我使用 react-advanced ...
[英]React 18 strict mode causing component to render twice
React 版本 18中對嚴格模式的更改導致我的代碼呈現兩次,這導致axios中止 controller 中的錯誤,但我不知道如何在應用程序呈現兩次后從瀏覽器控制台清除錯誤。 請注意:我正在開發一個注冊/登錄應用程序,即使在我成功登錄后, React也會將我帶回登錄頁面,因為axios錯誤useE ...
[英]What is difference between fragments and strict mode?
我的問題是除了明顯的區別之外,片段模式和嚴格模式之間的主要區別是什么? ...
[英]How can I write this expression that uses a string in brackets to reference a property of an object in Typescript
我在 Angular 中使用嚴格模式,我現在這是錯誤的原因。 我正在將 Angular 8 項目遷移到 Angular 13。 ...
[英]using this in JavaScript module
嗨,我在使用 JavaScript 時遇到了問題。 我寫了以下代碼(模擬): module.exports={ test(){ console.log('test') }, iffer(nb){ if(nb!==0){ this.test() }} } 我收到錯誤“測試不是 ...
[英]Did not parse stylesheet at 'ionic://localhost/styles.css' because non CSS MIME types are not allowed in strict mode
我正在開發跨平台移動應用程序並使用 ionic 和 angular 框架。 我的應用程序在 iOS 模擬器和設備上運行良好。 最近我買了一台帶 M1 芯片的新 Macbook Air。 當我嘗試在 M1 MacBook 上運行該應用程序時,出現以下錯誤。 當我嘗試在 web 檢查器中導航到 CSS ...
[英]Why is toString always running in strict mode?
我知道根據 ECMAScript 規范,非嚴格方法會將thisArg轉換為全局 object,如果null或undefined傳遞給它們。 這就是此代碼記錄 window object(在瀏覽器中)而不是 null 的原因: 我不明白的是,為什么對Object.prototype.toString ...
[英]How to import a library in non-strict mode in strict Angular app?
我正在嘗試在 Angular 11 項目中導入jschardet 。 當前版本 3.0.0不在嚴格模式下運行(在運行時拋出 TypeError)。 我試圖在一個最小的例子中重現這個問題。 因此,我生成了一個新的 Angular 項目並使用了相同的依賴項和配置(即我在兩個項目中使用相同的tsconfi ...
[英]Issue with Material-UI Select onChange
我正在使用 Material-UI select 並且無法訪問 select 值,因為我收到了警告: 這是我用作 Select 的一部分的代碼: 當我嘗試在屏幕上顯示 {myType} 時,什么也沒有出現。 是否有解決此問題的方法,因為我似乎只在更改 material-ui select 值時出現此 ...
[英]Function Scoped JavaScript Variables ACCESS on a 'NON Strict Mode '
function scoped() { var a = 150; let b = 300; const c = 500; } a = 300; // Why is it possible to access a function scoped variable? b = 600; // Same ...
[英]Fatal error after update MySQL5.6 to MariaDB10.3 - caused by sql strict mode?
我的 ISP 已更新托管我的應用程序的共享服務器。 它涉及從 MySQL 5.6 到 MariaDB 10.3 的更新。 ISP 寫道: MariaDB 在很大程度上與 MySQL 兼容,並且大多數 web 應用程序都可以與 Z7F96733E2087658831CE 正常工作。 換句話說,它們 ...
[英]Why filtering objects which has undefined key gives error in TypeScript strict mode
我有一段用 TypeScript 編寫的代碼,啟用了嚴格模式。 const arr: ({ name?: string })[] = [ { name: 'foo' }, {}, { name: 'bar' } ] function select(): string[] { ...
[英]How can I solve strict mode warning without removing strict mode in react index.js file
當我在下面的表格中使用<Button />時,它會說Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of RefFindNode which is inside St ...
[英]findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of DraggableCore which is inside StrictMode
Draggable 包在嚴格模式下導致錯誤: 警告:在 StrictMode 中不推薦使用findDOMNode 。 findDOMNode傳遞了一個位於 StrictMode 內的 DraggableCore 實例。 相反,直接向要引用的元素添加 ref。 在此處了解有關安全使用 ref ...
[英]Warnings with using modals from reactstrap
我有一些警告: 和 一個月前我沒有。 應用程序運行良好,但我總是想以正確的方式清除所有警告。 我假設我必須從 react-transition-group 添加過渡組件,但是我更喜歡在 CSS 中完成所有過渡和動畫(對我來說,使用 react-waypoint 效果更好)。 我的反應版本是 16.1 ...
[英]material-ui Drawer - findDOMNode is deprecated in StrictMode
我有一個簡單的 ReactJS 應用程序,它基於使用 StrictMode 的鈎子(無類)。 我使用的是 React 版本 16.13.1 和 Material-UI 版本 4.9.10。 在 Appbar 中,我使用的是抽屜。 我注意到當我打開抽屜時,我收到以下警告。 我在 web 上找到了一些 ...