react-proptypes

    0熱度

    1回答

    工作我建立了幾個組件和現在正在測試他們,但我看到的是,反應PropTypes不拋出任何錯誤,我似乎無法找到原因。 例組件 import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Icon } from 'components'; class Test extends Co

    1熱度

    1回答

    我想在外部庫定義中聲明一個組件(我正在編寫流程類型爲react-bootstrap),以便我有可選和必需的道具,並且不需要額外的道具。我有以下幾點: declare export type AlertProps = {| bsClass: bsClass, bsStyle: ?bsStyle, onDismiss: ?(e: SyntheticEvent) => an

    31熱度

    7回答

    我使用的終極版,但是當我運行我的代碼,我有這樣的錯誤: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead. 我安裝 npm i prop-types -S 但II仍然有相同的錯誤。 ./components/action/article.

    0熱度

    1回答

    不要與a similar question混淆詢問如何定義 PropTypes遞歸,我正在尋找一種方式,將參數傳遞本身是遞歸沒有: 浪費週期檢查已經檢查過的東西,並且 由於檢查器重複發生直到死亡,所以會拋出「警告:失敗的道具類型:超出最大調用堆棧大小」消息。 下面是一個簡單的例子,說明如何使用它。 const fields = [{ accessor: 'firstName',

    5熱度

    2回答

    guys! 有沒有人得到 "Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead." 而使用React 15.5.3 "react-transition-group/CSSTransitionGroup"附加。 它看起來像這

    3熱度

    2回答

    一起使用TypeScript和React的正確方法是什麼,既然他們已經在15.5版的單獨項目中提取了PropTypes? 從15.4升級到15.5之後,一切都運行正常,除了現在我在控制檯中得到這個警告:"Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package

    2熱度

    1回答

    我目前有一個Feed組件。它接受一個data prop,這是一個項目數組,並且支持一個children prop,該prop用於將數據映射到DOM元素。 現在,我正在嘗試創建功能以滾動到由children函數映射的此data屬性中的任何元素。但是,這意味着我需要存儲對它的引用。我不確定適當的語法/ api。這裏是我的基本代碼: class ScrollableFeed extends Compon

    1熱度

    2回答

    在一個陣營組成部分,如果我聲明: MyComponent.propTypes = { // An object that could be one of many types header: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, ]), } 我怎麼知道,如果head

    2熱度

    1回答

    由於我使用react.js庫中的PropTypes和CreateClass我有點擔心這些2在react.js的下一個主要版本上已被棄用。 更新到v15後,我收到有關它的警告。我讀過有一個腳本可以自動重構它(將PropTypes提取到新庫中),但現在找不到它。 任何人都試過這個腳本,可以分享他/她的經驗嗎? (並知道我在哪裏可以找到它當然) 保持我目前的語法有多安全?除了失去遷移到v16(光纖)的能

    0熱度

    2回答

    我處於需要使用字符串作爲對象的鍵的位置,該對象作爲道具傳遞給我的一些React組件。有沒有辦法使這個工作與反應PropTypes和通過eslint? 下面是一些示例代碼: MyComponent.propTypes = { 'string-key-name': PropTypes.shape({ foo: PropTypes.func.isRequired, bar: