{"id":5387,"date":"2022-11-26T07:37:22","date_gmt":"2022-11-26T12:37:22","guid":{"rendered":"https:\/\/www.cloudsurph.com\/?p=5387"},"modified":"2022-11-26T08:09:57","modified_gmt":"2022-11-26T13:09:57","slug":"how-to-use-forms-in-react","status":"publish","type":"post","link":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/","title":{"rendered":"ReactJS: How to Use Forms in React"},"content":{"rendered":"<p>Here, we can try to define ReactJS: how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react.<\/p>\n<h3><strong>Forms<\/strong><\/h3>\n<p>HTML form elements work a bit differently from other DOM elements in React because form elements naturally keep some internal state like example, this form in plain HTML accepts a single name below<\/p>\n<pre class=\"prettyprint\">&lt;form&gt;\r\n&lt;label&gt;\r\nName:\r\n&lt;input type=\"text\" name=\"name\" \/&gt;\r\n&lt;\/label&gt;\r\n&lt;input type=\"submit\" value=\"Submit\" \/&gt;\r\n&lt;\/form&gt;\r\n<\/pre>\n<h5>Now, the standard way to achieve this is with a technique called \u201c<strong>controlled components<\/strong>\u201d.<\/h5>\n<h5><em><strong>You can purchase your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting from Cloudsurph.com<\/a>,\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">Cloudsurph hosting<\/a>\u00a0is a reliable hosting option for business and personal projects. We offer insight and help on system configuration issues and code errors or bugs<\/strong>.<\/em><\/h5>\n<h3><strong>Controlled Components<\/strong><\/h3>\n<p>For HTML, form elements such as <strong>&lt;input&gt;,<\/strong> <strong>&lt;textarea&gt;<\/strong>, and <strong>&lt;select&gt;<\/strong> typically maintain their own state and update it based on user input other hand ReactJS.<\/p>\n<p>A mutable state is typically kept in the state property of components and that updated only with <strong>setState().<\/strong><\/p>\n<p>So, check the below example:<\/p>\n<pre class=\"prettyprint\">class NameForm extends React.Component {\r\n\u00a0 constructor(props) {\r\n\u00a0 \u00a0 super(props);\r\n\u00a0 \u00a0 this.state = {value: ''};\r\n\u00a0 \u00a0 this.handleChange = this.handleChange.bind(this);\r\n \u00a0 this.handleSubmit = this.handleSubmit.bind(this);\r\n\u00a0 }\r\n\u00a0 handleChange(event) {\r\n\u00a0 \u00a0 this.setState({value: event.target.value});\r\n\u00a0 }\r\n\u00a0 handleSubmit(event) {\r\n\u00a0 \u00a0 alert('A name was submitted: ' + this.state.value);\r\n\u00a0 \u00a0 event.preventDefault();\r\n\u00a0 }\r\n\u00a0 render() {\r\n\u00a0 \u00a0 return (\r\n\u00a0 \u00a0 \u00a0 &lt;form onSubmit={this.handleSubmit}&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Name:\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;input type=\"text\" value={this.state.value} onChange={this.handleChange} \/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;input type=\"submit\" value=\"Submit\" \/&gt;\r\n\u00a0 \u00a0 \u00a0 &lt;\/form&gt;\r\n\u00a0 \u00a0 );\r\n\u00a0 }\r\n}\r\n<\/pre>\n<h3><strong>The textarea Tag<\/strong><\/h3>\n<p>In the HTML, an <strong>&lt;textarea&gt;<\/strong> element identify its text by its children like the below code<\/p>\n<pre class=\"prettyprint\">&lt;textarea&gt;\r\nHello there, this is some text in a text area\r\n&lt;\/textarea&gt;\r\n<\/pre>\n<p>In ReactJS, a <strong>&lt;textarea&gt;<\/strong> uses a value attribute instead and this way, a form using a <strong>&lt;textarea&gt;<\/strong> can be written very similarly to a form that uses a single-line input like the below example:<\/p>\n<pre class=\"prettyprint\">class EssayForm extends React.Component {\r\n\u00a0 constructor(props) {\r\n\u00a0 \u00a0 super(props);\r\n\u00a0 \u00a0 this.state = {\r\n\u00a0 \u00a0 \u00a0 value: 'Please write an essay about your favorite DOM element.'\r\n\u00a0 \u00a0 };\r\n\u00a0 \u00a0 this.handleChange = this.handleChange.bind(this);\r\n\u00a0 \u00a0 this.handleSubmit = this.handleSubmit.bind(this);\r\n\u00a0 }\r\n\u00a0 handleChange(event) {\r\n\u00a0 \u00a0 this.setState({value: event.target.value});\r\n\u00a0 }\r\n\u00a0 handleSubmit(event) {\r\n\u00a0 \u00a0 alert('An essay was submitted: ' + this.state.value);\r\n\u00a0 \u00a0 event.preventDefault();\r\n\u00a0 }\r\n\u00a0 render() {\r\n\u00a0 \u00a0 return (\r\n\u00a0 \u00a0 \u00a0 &lt;form onSubmit={this.handleSubmit}&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Essay:\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;textarea value={this.state.value} onChange={this.handleChange} \/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;input type=\"submit\" value=\"Submit\" \/&gt;\r\n\u00a0 \u00a0 \u00a0 &lt;\/form&gt;\r\n\u00a0 \u00a0 );\r\n\u00a0 }\r\n}\r\n<\/pre>\n<h3><strong>The select Tag<\/strong><\/h3>\n<p>In the HTML, &lt;select&gt; creates a drop-down list like for example below and this HTML creates a drop-down list of flavors:<\/p>\n<p><strong><em>You can check our article:\u00a0<a href=\"https:\/\/www.cloudsurph.com\/adonisjs-rest-api-crud-setup\/\">AdonisJS: REST API simple CRUD Operation<\/a>. IF you want then buy a good, reliable, secure web\u00a0<a href=\"https:\/\/www.cloudsurph.com\/windows-vps-hosting\/\">hosting<\/a>\u00a0service \u00a0from here:\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">click here<\/a><\/em><\/strong><\/p>\n<pre class=\"prettyprint\">&lt;select&gt;\r\n&lt;option value=\"grapefruit\"&gt;Grapefruit&lt;\/option&gt;\r\n&lt;option value=\"lime\"&gt;Lime&lt;\/option&gt;\r\n&lt;option selected value=\"coconut\"&gt;Coconut&lt;\/option&gt;\r\n&lt;option value=\"mango\"&gt;Mango&lt;\/option&gt;\r\n&lt;\/select&gt;\r\n<\/pre>\n<p>This is more suitable in a controlled component because you can only need to update it in one place:<\/p>\n<pre class=\"prettyprint\">class FlavorForm extends React.Component {\r\n\u00a0 constructor(props) {\r\n\u00a0 \u00a0 super(props);\r\n\u00a0 \u00a0 this.state = {value: 'coconut'};\r\n\u00a0 \u00a0 this.handleChange = this.handleChange.bind(this);\r\n\u00a0 \u00a0 this.handleSubmit = this.handleSubmit.bind(this);\r\n\u00a0 }\r\n\u00a0 handleChange(event) {\r\n\u00a0 \u00a0 this.setState({value: event.target.value});\r\n\u00a0 }\r\n\u00a0 handleSubmit(event) {\r\n\u00a0 \u00a0 alert('Your favorite flavor is: ' + this.state.value);\r\n\u00a0 \u00a0 event.preventDefault();\r\n\u00a0 }\r\n\u00a0 render() {\r\n\u00a0 \u00a0 return (\r\n\u00a0 \u00a0 \u00a0 &lt;form onSubmit={this.handleSubmit}&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Pick your favorite flavor:\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;select value={this.state.value} onChange={this.handleChange}&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;option value=\"grapefruit\"&gt;Grapefruit&lt;\/option&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;option value=\"lime\"&gt;Lime&lt;\/option&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;option value=\"coconut\"&gt;Coconut&lt;\/option&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;option value=\"mango\"&gt;Mango&lt;\/option&gt;\r\n \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/select&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;input type=\"submit\" value=\"Submit\" \/&gt;\r\n\u00a0 \u00a0 \u00a0 &lt;\/form&gt;\r\n\u00a0 \u00a0 );\r\n\u00a0 }\r\n}\r\n<\/pre>\n<h3><strong>The file input Tag<\/strong><\/h3>\n<p>In the HTML, an &lt;input type=&#8221;file&#8221;&gt; lets the user choose one or more files from their own device storage to be uploaded to a server and manipulated by JavaScript through the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/File\/Using_files_from_web_applications\">File API<\/a> like the below code<\/p>\n<pre class=\"prettyprint\">&lt;input type=\"file\" \/&gt;\r\n<\/pre>\n<h3><strong>Handling Multiple Inputs<\/strong><\/h3>\n<p>And let the handler function select what to do based on the value of <strong>event.target.name<\/strong>:<\/p>\n<pre class=\"prettyprint\">class Reservation extends React.Component {\r\nconstructor(props) {\r\n\u00a0 super(props);\r\n \u00a0 this.state = {\r\n\u00a0 \u00a0 \u00a0 isGoing: true,\r\n\u00a0 \u00a0 \u00a0 numberOfGuests: 2\r\n\u00a0 \u00a0 };\r\n\u00a0 \u00a0 this.handleInputChange = this.handleInputChange.bind(this);\r\n\u00a0 }\r\n\u00a0 handleInputChange(event) {\r\n\u00a0 \u00a0 const target = event.target;\r\n\u00a0 \u00a0 const value = target.type === 'checkbox' ? target.checked : target.value;\r\n\u00a0 \u00a0 const name = target.name;\r\n\u00a0 \u00a0 this.setState({\r\n\u00a0 \u00a0 \u00a0 [name]: value\r\n\u00a0 \u00a0 });\r\n\u00a0 }\r\n\u00a0 render() {\r\n\u00a0 \u00a0 return (\r\n\u00a0 \u00a0 \u00a0 &lt;form&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Is going:\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;input\u00a0 name=\"isGoing\"\u00a0 type=\"checkbox\"\u00a0 checked={this.state.isGoing}\u00a0 onChange={this.handleInputChange} \/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;br \/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;label&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Number of guests:\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;input name=\"numberOfGuests\" type=\"number\" value={this.state.numberOfGuests} onChange={this.handleInputChange} \/&gt;\u00a0 \u00a0 \u00a0 \u00a0 \r\n&lt;\/label&gt;\r\n\u00a0 \u00a0 \u00a0 &lt;\/form&gt;\r\n\u00a0 \u00a0 );\r\n\u00a0 }\r\n}\r\n<\/pre>\n<h3><strong>Controlled Input Null Value<\/strong><\/h3>\n<p>Now, specifying the <strong>value<\/strong> prop on a <a href=\"https:\/\/reactjs.org\/docs\/forms.html#controlled-components\">controlled component<\/a> prevents the user from changing the input unless you desire so and if you\u2019ve specified a <strong>value<\/strong><\/p>\n<p>But the input is still editable, you may have accidentally set the <strong>value<\/strong> to <strong>undefined<\/strong> or <strong>null<\/strong>:<\/p>\n<pre class=\"prettyprint\">ReactDOM.createRoot(mountNode).render(&lt;input value=\"hi\" \/&gt;);\r\nsetTimeout(function() {\r\n\u00a0 ReactDOM.createRoot(mountNode).render(&lt;input value={null} \/&gt;);\r\n}, 1000);\r\n<\/pre>\n<p>If you enjoyed reading this article and have more questions please reach out to our\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/submitticket.php?step=2&amp;deptid=1\">support team<\/a>\u00a0via live chat or\u00a0<a href=\"mailto:support@cloudsurph.com\">email<\/a>\u00a0and we would be glad to help you. we provide server\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting<\/a>\u00a0for all types of need and we can even get your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">server<\/a>\u00a0up and running with the service of your choice.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here, we can try to define ReactJS: how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react. Forms HTML form elements work a bit differently from other DOM elements in React because form elements naturally keep some internal state like example, this form in [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":5388,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[157,25,158,159,151,1],"tags":[54,47,105,103,48,113],"class_list":["post-5387","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7","category-web-hosting-virtualization","category-linux-basics","category-linux-server","category-react-js","category-virtual-private-servers","tag-best-vps-hosting-server-maryland","tag-cheap-cloud-servers","tag-cheap-storage-server-hosting","tag-cheapest-vps","tag-dedicated-server-hosting-in-washington-d-c","tag-speed-test-vps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>how to use Forms in ReactJS<\/title>\n<meta name=\"description\" content=\"how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"how to use Forms in ReactJS\" \/>\n<meta property=\"og:description\" content=\"how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudsurph Web Hosting Washington D.C.\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/CloudSurph\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-26T12:37:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-26T13:09:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Forms-in-ReactJS.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1264\" \/>\n\t<meta property=\"og:image:height\" content=\"760\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rony\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cloudsurph\" \/>\n<meta name=\"twitter:site\" content=\"@Cloud_Surph\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rony\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/\"},\"author\":{\"name\":\"Rony\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\"},\"headline\":\"ReactJS: How to Use Forms in React\",\"datePublished\":\"2022-11-26T12:37:22+00:00\",\"dateModified\":\"2022-11-26T13:09:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/\"},\"wordCount\":471,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Forms-in-ReactJS.jpg\",\"keywords\":[\"Best VPS hosting server Maryland\",\"Cheap Cloud Servers\",\"Cheap Storage Server Hosting\",\"Cheapest VPS\",\"Dedicated Server Hosting in Washington D.C\",\"Speed test VPS\"],\"articleSection\":[\"CentOS 7\",\"Cloud Hosting\",\"Linux Basics\",\"Linux Server\",\"React Js\",\"VPS Servers\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/\",\"name\":\"how to use Forms in ReactJS\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Forms-in-ReactJS.jpg\",\"datePublished\":\"2022-11-26T12:37:22+00:00\",\"dateModified\":\"2022-11-26T13:09:57+00:00\",\"description\":\"how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Forms-in-ReactJS.jpg\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2022\\\/11\\\/how-to-use-Forms-in-ReactJS.jpg\",\"width\":1264,\"height\":760},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/how-to-use-forms-in-react\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cloudsurph.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ReactJS: How to Use Forms in React\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"name\":\"Cloudsurph Web Hosting Washington D.C.\",\"description\":\"Dedicated Server Hosting\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cloudsurph.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\",\"name\":\"CloudSurph Technology Solutions\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"width\":2348,\"height\":1692,\"caption\":\"CloudSurph Technology Solutions\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/CloudSurph\\\/\",\"https:\\\/\\\/x.com\\\/Cloud_Surph\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\",\"name\":\"Rony\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"caption\":\"Rony\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/cloudsurph\"],\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/author\\\/ron\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"how to use Forms in ReactJS","description":"how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/","og_locale":"en_US","og_type":"article","og_title":"how to use Forms in ReactJS","og_description":"how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react","og_url":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/","og_site_name":"Cloudsurph Web Hosting Washington D.C.","article_publisher":"https:\/\/www.facebook.com\/CloudSurph\/","article_published_time":"2022-11-26T12:37:22+00:00","article_modified_time":"2022-11-26T13:09:57+00:00","og_image":[{"width":1264,"height":760,"url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Forms-in-ReactJS.jpg","type":"image\/jpeg"}],"author":"Rony","twitter_card":"summary_large_image","twitter_creator":"@cloudsurph","twitter_site":"@Cloud_Surph","twitter_misc":{"Written by":"Rony","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/#article","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/"},"author":{"name":"Rony","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed"},"headline":"ReactJS: How to Use Forms in React","datePublished":"2022-11-26T12:37:22+00:00","dateModified":"2022-11-26T13:09:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/"},"wordCount":471,"publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"image":{"@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Forms-in-ReactJS.jpg","keywords":["Best VPS hosting server Maryland","Cheap Cloud Servers","Cheap Storage Server Hosting","Cheapest VPS","Dedicated Server Hosting in Washington D.C","Speed test VPS"],"articleSection":["CentOS 7","Cloud Hosting","Linux Basics","Linux Server","React Js","VPS Servers"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/","url":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/","name":"how to use Forms in ReactJS","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/#primaryimage"},"image":{"@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Forms-in-ReactJS.jpg","datePublished":"2022-11-26T12:37:22+00:00","dateModified":"2022-11-26T13:09:57+00:00","description":"how to use Forms, react Forms, controlled components in react, ReactJS controlled components and how can we use Forms in react","breadcrumb":{"@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/#primaryimage","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Forms-in-ReactJS.jpg","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2022\/11\/how-to-use-Forms-in-ReactJS.jpg","width":1264,"height":760},{"@type":"BreadcrumbList","@id":"https:\/\/www.cloudsurph.com\/how-to-use-forms-in-react\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cloudsurph.com\/"},{"@type":"ListItem","position":2,"name":"ReactJS: How to Use Forms in React"}]},{"@type":"WebSite","@id":"https:\/\/www.cloudsurph.com\/#website","url":"https:\/\/www.cloudsurph.com\/","name":"Cloudsurph Web Hosting Washington D.C.","description":"Dedicated Server Hosting","publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cloudsurph.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.cloudsurph.com\/#organization","name":"CloudSurph Technology Solutions","url":"https:\/\/www.cloudsurph.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","width":2348,"height":1692,"caption":"CloudSurph Technology Solutions"},"image":{"@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/CloudSurph\/","https:\/\/x.com\/Cloud_Surph"]},{"@type":"Person","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed","name":"Rony","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","caption":"Rony"},"sameAs":["https:\/\/x.com\/cloudsurph"],"url":"https:\/\/www.cloudsurph.com\/author\/ron\/"}]}},"_links":{"self":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/comments?post=5387"}],"version-history":[{"count":6,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5387\/revisions"}],"predecessor-version":[{"id":5394,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5387\/revisions\/5394"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media\/5388"}],"wp:attachment":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media?parent=5387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/categories?post=5387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/tags?post=5387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}