react-redux 无法显示我的容器
react-redux can't display my container
我想用react-redux
和axios
获取一些json数据,更新我的组件,但是我试了很多次,还是不行,生成的 html 是这样的:
<div id="root">
<simple_result_container data-reactroot=""></simple_result_container>
</div>
这是我的代码,我遗漏了什么吗?请尽可能多地告诉我,这让我很困惑,你能解释一下我如何通过使用 [= 来获取和显示 json 数据吗? 13=]。如有任何帮助,我们将不胜感激。
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>
);
}
}
组件名必须大写
我想用react-redux
和axios
获取一些json数据,更新我的组件,但是我试了很多次,还是不行,生成的 html 是这样的:
<div id="root">
<simple_result_container data-reactroot=""></simple_result_container>
</div>
这是我的代码,我遗漏了什么吗?请尽可能多地告诉我,这让我很困惑,你能解释一下我如何通过使用 [= 来获取和显示 json 数据吗? 13=]。如有任何帮助,我们将不胜感激。
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>
);
}
}
组件名必须大写