Need equivalent of JSP tag in REACT

Viewed 28
public class RadioOptions{

          private String key;
          private String value;
          //getter and setter methods
       }

Here you can retrieve the calls using the key value:

List<RadioOptions> radioOption= new ArrayList<RadioOptions>();
        radioOption.add( new RadioOptions("1", "This is option 1.") );
        radioOption.add( new RadioOptions("2", "This is option 2.") );
        radioOption.add( new RadioOptions("3", "This is option 3.") );
        radioOption.add( new RadioOptions("4", "This is option 4.") );

What will be react equivalent tag of this JSP Tag:

 <s:radio label="Please select the best choice" name="answer" list="radioOption" 
 listKey="key" listValue="value" value="1" />

1 Answers

You can use HTML <input type="radio"> to select only one of a limited number of choices . the same way your JSP Tag <s:radio/> works .

Example :

<label>
  <input
    type="radio"
    name="answer"
    value="1"
    
  />
  Please select the best choice
</label>

You can find more information on how to use radio buttons in React

Related