2016-08-23 2 views
0

REDUX 업체 인의 말을하자 ? 나는 그것을 응용 프로그램에서 얻을 수 있지만 어떻게 그것의 아이에게 그것을 전달할 수 있는지 모르겠다. 당신이 App을 위해했던 것처럼반응 내가 메인 JS 파일이 그랜드 아이

import React from 'react' 
import { connect } from 'react-redux'; 

export class Proba extends React.Component 
{ 
    constructor(props) 
    { 
     super(props); 
     console.log(this.props); 
    } 


    render() 
    { 
     return <p>{this.props.a}</p>; 
    } 
} 

function anotherMapStateToProps(store) 
{ 
    return { 
     a: 'ok' 
    }; 
} 

function anoterMapDispatchToProps(dispatch) 
{ 
    return {}; 
} 

export default connect(anotherMapStateToProps, anoterMapDispatchToProps)(Proba) 

답변

0

같은 방법 :

나는 다음과 같은 있지만 작동하지 않습니다, 난 여전히 내 proba.js의 빈 객체를 얻을를 시도했다. connect() 그리고 소품으로 구성 요소에 전달하려는 상점의 값을 선택하십시오.

export default connect(anotherMapStateToProps, anoterMapDispatchToProps)(Proba) 
+0

나는 그것을 시도, 내 질문을 업데이 트했습니다. 내 app.js에서 아무것도 변경되지 않았습니다. –