2017-12-18 264 views
0

我有這樣的反應成分:https://gist.github.com/emilevictor/007a10aa1669829feb940b9548e582a1componentWillUpdate()和componentDidUpdate()調用正確的內容,呈現不更新

我拍攝過一個終極版的傳奇去從服務器獲取一些數據。它已成功設置在this.props.statistics中,並且重新呈現被觸發。這些函數正確調用按以下順序時的狀態Redux的改變:

componentWillUpdate(...) 渲染(...) componentDidUpdate(...)

話雖如此, DOM不會更改以反映this.props.statistics中的新數字。有誰知道什麼可能會出錯?

回答

0

這是由於這兩條線路:

const LayoutWrapper = props => (
    <ChartWrapper> 
    <Async 
     load={import(/* webpackChunkName: "ReactChart2-layoutWrapper" */ "../../../components/utility/layoutWrapper")} 
     componentProps={props} 
    /> 
    </ChartWrapper> 
); 

const PageHeader = props => (
    <Async 
    load={import(/* webpackChunkName: "ReactChart2-pageHeader" */ "../../../components/utility/pageHeader")} 
    componentProps={props} 
    /> 
); 

一旦取消,他們固定的問題。想知道爲什麼它會產生這種效果的更多細節。