I am making a clothing store, I made the product presentation page. it works fine, but when i reload the page, state reverts to the initial state and returned to the console "y a rien pour le remplir". as the componentDidMount did not work.
---the image before reload
---the image after reload
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>)}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…