如何解决重新加载页面时状态消失
我在做一家服装店,我做了产品展示页面。它工作正常,但是当我重新加载页面时,状态恢复到初始状态并返回到控制台“y a rien pour le remplir”。因为 componentDidMount 不起作用。 ---重新加载前的图像
componentDidMount(){
const {load_state} = this.props // You Need Thi
let request = new FormData;
request.append("getters_produit","true");
Axios.post('http://localhost/e_commerce/src/PHP/get.PHP',request).then(function(reponce){
//handle succes
load_state(reponce.data.les_produit);
}).catch(function(error){
alert(error);
}).then(function(){
//always executed
});
}
render(){
return (<div className="les_produit">
{(this.props.state.liste_produit == "none") ? console.log("y a rien pour le remplir") :this.romplir_page(this.props.state.liste_produit) }
</div>)}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。