redux

    1熱度

    1回答

    我嘗試更新我的狀態時添加一個項目在數組中,使用react/redux和REDEX傳奇中間件。但是,在我這樣做的地方,我有一個數組,其中每個項目都有一個索引(0,1,2 ....),但是當我添加新項目(名爲step)時,新項目沒有索引,但它是這樣的: [ 0: item1, 1: item2, 2: item3, step: newItem ] 而且我想

    0熱度

    2回答

    我是React的新手,請記住這一點。 我想渲染從food2fork API獲取的食譜列表,但即使數據獲取正確,我也無法獲取更新視圖。 這裏的recipe_list.js: import React, { Component } from "react"; import { connect } from "react-redux"; class RecipesList extends

    -1熱度

    1回答

    我指的是在一個帖子中丹阿布拉莫夫指出: PSA:React.PureComponent可以使您的應用程序速度較慢,如果你隨心使用。 (Dan's tweet on the topic) 有人能解釋一下?謝謝。

    2熱度

    2回答

    我試圖更新機內部的狀態改變嵌套的對象,所以我用map,我知道我不應該發生變異的對象或嵌套對象爲數組或對象傳播對象。但似乎我無法真正改變深度嵌套的價值。 旁邊的事實,我不能改變的狀態,我真的不喜歡代碼的樣子,尤其是環路我需要做的數量,只是改變一個屬性。我覺得這樣做有更好,更可讀和更高效的方式。 這是國家: const items = [{ name: 'item 1', id:

    0熱度

    1回答

    console.log(bankStore.getState().balance); 當我記錄這個,我得到0預期。 然後我有傳遞道具<BankApp />組分(如我明白)容器: const mapStateToProps = state => { return { balance: state.balance }; }; const mapDispatchTo

    0熱度

    2回答

    我通過在React應用改變redux狀態處理404 error,所以如果有一個error,我更新state.error到404,我render取決於狀態的組件。這個display()函數在我的React容器裏面。 display() { const { weather: { weathers } } = this.props; const error = this.prop

    1熱度

    2回答

    這裏就是我試圖做的一個例子: const setView = state => payload => ({ ...state, view: payload }); const reducers = { SET_VIEW: setView }; export default (state = initialState, action) => reducers[action.typ

    1熱度

    1回答

    我正在使用React native 0.50.4和react navigation 1.0.0-beta.19。我有一個性能問題。我使用Tab navigator與4個選項卡基本上每個表單(最多11個字段) 我已經將所有表單字段(全部4個選項卡)以redux狀態連接起來。以便在最後一個選項卡保存時數據可用。 現在用戶可以在編輯時(通過單擊按鈕編輯)導航到此Tab navigator,每個標籤的co

    0熱度

    1回答

    我試圖在 https://codepen.io/stowball/post/a-dummy-s-guide-to-redux-and-thunk-in-react#understanding-redux-4 運行從教程中的代碼使用[終極版連接]上 https://jscomplete.com/repl/ ,但執行與下面的錯誤而失敗: ReferenceError: connect is not d

    0熱度

    2回答

    const store = createStore( rootReducer, initialState, compose( applyMiddleware(thunk, api, wsMiddleware, createLogger()), typeof window === 'object' && typeof window.devToolsE