PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, July 17, 2022

[FIXED] What is uncontrolled input field in a React app

 July 17, 2022     javascript, reactjs, warnings     No comments   

Issue

What does it mean when React says input field is an uncontrolled field`? How it will affect the web page with a form of uncontrolled input fields. I can see a warning message in the console while changing values of the field, other than that what are other issues going to be there on the application?


Solution

An uncontrolled input is simply one where you're not using React to control the input's value (e.g, you don't use value={this.state.value} or similar); instead, you use a ref and get the value from the DOM directly. This means the DOM contains the "source of truth" for that piece of state, rather than your React model containing the source of truth for it.

React documentation links:

  • Uncontrolled components
  • Forms (including controlled components)


Answered By - T.J. Crowder
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing