React Textbox onChange Example | React Text Input Tutorial

By Hardik Savani September 5, 2020 Category : React JS

Today, react textbox onchange example is our main topic. i explained simply about react textbox component example. we will help you to give example of react js textbox example. you will learn how to use textbox in react js. Let's see bellow example how to use input in react component.

If you are new in react then you want to see how to use text box in react app. but it's very easy to use text 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 "name" input field 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 = {

name: 'Hardik'


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

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


handleChange(event) {



handleSubmit(event) {




render() {

return (


<h1>React Textbox onChange Example -</h1>

<form onSubmit={this.handleSubmit}>




onChange={this.handleChange} />

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






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


{name: "Hardik ss"}

I hope it can help you...

Tags :