0
我想用react-redux
和axios
来获取一些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>
);
}
}
我的错!感谢您的提醒。 – McGrady