re: Create Simple Popup Example In React Application VIEW POST

FULL DISCUSSION
 

Thanks for this - one minor change that is recommended by ESlint is to put the function binding in the constructor of the App component. ie:

class App extends React.Component {
  static propTypes = {
    accounts: PropTypes.arrayOf(PropTypes.object).isRequired,
    options: PropTypes.objectOf(PropTypes.any).isRequired,
    actions: PropTypes.func.isRequired,
  };

  constructor(props) {
    super(props);
    this.state = { showPopup: false };
    this.togglePopup = this.togglePopup.bind(this);
  }

  togglePopup() {
    this.setState({
      showPopup: !this.state.showPopup,
    });
  }

code of conduct - report abuse