How do I use radio buttons in React?

前端 未结 4 1865
别那么骄傲
别那么骄傲 2021-02-13 22:36

I\'m making a form, and I was in need of a radio input. How do I get the checked radio input in a onSubmit-function, what is the correct way?

This is my code, I myRadioI

4条回答
  •  悲&欢浪女
    2021-02-13 23:01

    i use this solution for radio button two way binding with active :

    inside render() method:

    const items = [
        {label: 'one', checked: false},
        {label: 'two', checked: true},
        {label: 'three', checked: true}
    ];
    
    items.map((item, index) => (
        
    ))

提交回复
热议问题