2017-03-06 78 views
0

我想用react-reduxaxios來獲取一些json數據,並更新我的組件,但我已經嘗試了很多次,它仍然不起作用,生成的html就像這樣:?react-redux無法顯示我的容器

<div id="root"> 
    <simple_result_container data-reactroot=""></simple_result_container> 
</div> 

這裏是我的代碼,我失去的東西,請告訴我儘可能多地,這是非常混亂給我,你能解釋我如何可以獲取和使用react-redux。任何顯示JSON數據幫助將不勝感激。

index.js

render(
    <Provider store={store}> 
     <simple_result_container ddd="da" /> 
    </Provider>, 
    document.getElementById('root') 
); 

simple_result_container.js

@connect(state => state, dispatch => bindActionCreators({get_simple_result}, dispatch)) 
export class simple_result_container extends Component { 
    constructor(props) { 
     super(props); 
    } 

    componentWillMount() { 
     const {simple_result_value} = this.props.simple_result_tmp; 
     if (simple_result_value === "") { 
      this.props.get_simple_result(); 
     } 
    } 
    render() { 
     const {simple_result_value} = this.props.simple_result_tmp; 
     return (
      <div className={bb}> 
       <div className="aa"> 
        <simple_result_component 
         code={simple_result_value.code} 
         msg={simple_result_value.msg} 
        /> 
       </div> 
      </div> 
     ); 
    } 
} 

回答