Im Neuling, um js zu reagieren, ich weiß nicht, was falsch ist mit unter Code, aber ich bekomme SetState ist kein Funktionsfehler.Bitte helfen Sie mir, dies zu beheben.Reactjs this.setState ist kein Funktionsfehler
class AppBarLayout extends React.Component {
constructor(props) {
super(props);
this.state = {
visibleSideBar:true,
slide:""
}
}
showProfile(){
this.setState({
slide:'slide'
});
console.log(this.state.slide);
}
render(){
return(
<div>
<header>
<NavBar show={this.showProfile}/>
<Profile slide={this.state.slide} />
</header>
</div>
);
}
}
export default AppBarLayout;
Mögliche Duplikat [Kann nicht Instanz zugreifen reagieren (diese) innerhalb Ereignishandler] (http://stackoverflow.com/questions/29577977/unable-to-access-react- instance-this-inside-event-handler) –