React Radio Button onchange | React Radio Button Example

By Hardik Savani September 6, 2020 Category : React JS

Hi Dev,

In this post, we will learn how to use radio button in react js. This article will give you simple example of react radio button onchange event example. In this article, we will implement a react radio buttons example. you'll learn react radio button group example.

If you are new in react js then you want to see how to use radio button in react app. but it's very easy to use radio button input in react js app. you can use it as you use in html and you have to write change event on it. using that change event you have to store value into form state. so you can get that data on submit.

In this example, we will take simple "gender" with male and female radio button and add onchange event with handleChange() then we will assign value on state variable array. Then on submit event we will take that values with state variable.

So, let's see bellow preview and code:

Example Code:

import React, { Component } from 'react';

import { render } from 'react-dom';

class App extends Component {

constructor() {


this.state = {

gender: ''


this.handleChange = this.handleChange.bind(this);

this.handleSubmit = this.handleSubmit.bind(this);


handleChange(event) {



handleSubmit(event) {




render() {

return (


<h1>React Radio Buttons onChange Example -</h1>

<form onSubmit={this.handleSubmit}>

<strong>Select Gender:</strong>















<input type="submit" value="Submit" />






render(<App />, document.getElementById('root'));


{gender: "male"}

I hope it can help you...

Tags :