src/components/RadioPoll.js
/**
   * Handles a radio selection on this components form. Only a single
   * selection is valid at a time.
   */
Handles a radio selection on this components form. Only a single
selection is valid at a time.
Handles a radio selection on this components form . Only a single selection is valid at a time .
handleRadio(e) {
    const targetId = e.currentTarget.id;
    this.setState((prevState) => {
      const newChoices = prevState.choices.map((choice) => {
        choice.checked = (targetId === choice.label);
        return choice;
      });
      return { ...prevState, choies: newChoices, submitValid: true }
    });
  }
handleRadio ( e ) { const targetId = e . currentTarget . id ; this . setState ( ( prevState ) => { const newChoices = prevState . choices . map ( ( choice ) => { choice . checked = ( targetId === choice . label ) ; return choice ; } ) ; return { ... prevState , choies : newChoices , submitValid : true } } ) ; }
Handles a radio selection on this components form.
Handles a radio selection on this components form .
// represents the radio that is selected // if the radio has the same Id as our choice, it means // the user is currently selecting it // the pre-requisite to submit a vote is having any of the available // options selected