2016-11-20 8 views
1

にエラーを取り除くためにどのように任意のアイデアを使用してproperty退会: Property not found in FilterLinkが財産見つかりません - flowtypeは/反応し、この

を再び
class FilterLink extends React.Component { // container component - provides data and behaviour for the used Link presentation component 
    componentDidMount() { 
    this.unsubscribe= store.subscribe(()=> this.forceUpdate()); // FLOW ERROR: property `unsubscribe`Property not found in ... 

    // this is needed because if the parent component does not update when then 
    // store changes, this component would render a stale value 
    }; 
    componentWillUnmount() { 
    this.unsubscribe(); 
    } 
    render(){ 
    const props = (this.props:{filter:State$VisibilityFilter,children:React$Element<*>}); 
    const state = store.getState(); 
    return (
     <Link 
     active ={props.filter===state.visibilityFilter} 
     onClick = {()=> store.dispatch (({ type:'SET_VISIBILITY_FILTER', filter: props.filter }:Action$SetVisibilityFilter))} 
     children= {props.children} /> 
    ) 
    }; 
}; 

答えて

2

、私は、IRCにGreenJelloから感謝の助けを得ました!これはあまりにも助け

unsubscribe:Function; // SOLUTION !! 
    componentDidMount() { 
    this.unsubscribe= store.subscribe(()=> this.forceUpdate()); 
    // this is needed because if the parent component does not update when then 
    // store changes, this component would render a stale value 
    }; 
    componentWillUnmount() { 
    this.unsubscribe(); 
    } 

https://flowtype.org/docs/react.html

この

は溶液で
関連する問題