React JS - Get Input Box Data

In React, we can Get Input Box Data using target.value

Example 1 : Get Input Box Data & Display on Console

  • Create a Input Field.
  • Use event onChange and call a function
  • Create function along with a parameter.
  • Get the input box data using target.value and Display on console.


Example 2 : Get Input Box Data & Display on Browser

  • Create a Input Field.
  • Use event onChange and call a function
  • Create <h1> tag and call dynamic data variable {data}
  • Create a constant with variable data & setData and set useState initial value as Null.
  • Create function along with a parameter.
  • Fetch the input box data and call setData & set the input box data in it.


Github Link :

Comments