Skip to main content
added 275 characters in body
Source Link
Juan Picado
  • 1.9k
  • 18
  • 35

Try using the .bind(this) withUpdate your method. It seems NextButton is looking for setState in. Use the wrong contextevent within your presentational component.

 <NextButton onClick=next={this.nextImg.bind}/>

And the NextButton component should looks like this.

import React from 'react';
 const NextButton = (thisprops) =>{
 return (<div>
    <button onClick={props.next}>next</>button>
  </div>
 );
};

Try using the .bind(this) with your method. It seems NextButton is looking for setState in the wrong context.

 <NextButton onClick={this.nextImg.bind(this)}/>

Update your NextButton. Use the event within your presentational component.

<NextButton next={this.nextImg}/>

And the NextButton component should looks like this.

import React from 'react';
 const NextButton = (props) =>{
 return (<div>
    <button onClick={props.next}>next</button>
  </div>
 );
};
Source Link
Juan Picado
  • 1.9k
  • 18
  • 35

Try using the .bind(this) with your method. It seems NextButton is looking for setState in the wrong context.

 <NextButton onClick={this.nextImg.bind(this)}/>