react 使用localStorage

const storage=window.localStorage;

if(storage!=undefined){

if(storage.hasOwnProperty("cid")&&storage.getItem("cid")>0){

this.setState({

toogle:false

})

}

}else{

this.setState({

toogle:true

})

}

}

你可能感兴趣的:(react 使用localStorage)