Bug: Should function isControlled use !== ?
See original GitHub issueReact version: 16.20.0
Steps To Reproduce
- inital state is
undefined
, theuseAsyncCustomHooks
will call an async function eg:navigator.geolocation.getCurrentPosition
- the state will changed later
Link to code example:
function FC() {
const [state] = useAsyncCustomHooks()
return <input type="text" value={state}/>
}
The current behavior
dev tool throws Warning: A component is changing a controlled input of type hidden to be uncontrolled. Input elements should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components
The expected behavior
Not throw that warning, the related source code is: https://github.com/facebook/react/blob/c601f7a64640290af85c9f0e33c78480656b46bc/packages/react-dom/src/client/ReactDOMFiberInput.js#L37-L40
why not !==
but !=
😊
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Insects and their Injury to Plants - CT.gov
Many bugs suck the sap or cell contents from plants as a source of food. ... The use of resistant plant material provides...
Read more >INSECT FAT BODY: ENERGY, METABOLISM, AND ... - NCBI
Insect adipocytes can store a great amount of lipid reserves as ... The insect fat body plays an essential role in energy storage...
Read more >The gut microbiota of insects – diversity in structure and function
The microorganisms in insect guts can include protists, fungi, archaea, and bacteria. Protists are best studied in the lower termites and wood roaches, ......
Read more >Bugs that are fixed in SQL Server 2012 Service Pack 2
Introduction. This article lists the bugs that are fixed in Microsoft SQL Server 2012 Service Pack 2 (SP2). Notes. Additional fixes that are...
Read more >insect - Hormones, reproduction, senses & behavior
Molting and metamorphosis in insects are controlled by hormones. Reproduction is sexual in almost all insects. They have elaborate sense organs for touch, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Many applications rely on a value of
undefined
to mean an uncontrolled component. If you want to treatundefined
to mean a controlled empty box, you can always write something like:Hope that helps.
Thanks for your reminder, I get it