Cannot read property 'keepState' of undefined
See original GitHub issueIt seems like with the 2V you added a new property called ‘keepState’.
When I unmount a component that uses the Form component I get the following error message.
Uncaught TypeError: Cannot read property ‘keepState’ of undefined at FormController.deregister (index.js?5725:4461) at eval (index.js?5725:5038)
Here my code.
// PARENT COMPONENT
toogleForm = () => {
this.setState((prevState) => ({
form_open: !prevState.form_open
}))
}
render(){
return {this.state.form_open && <EstimateForm/> }
}
// COMPONENT THAT USES FORM
const EstimateForm = (props) => {
return (
<Form
className='Modal_form'
>
<Text field='code' />
<div className="Modal_form_section">
<button className="Modal_form_submit" type="submit">
Guardar
</button>
</div>
</Form>
)
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top Results From Across the Web
React with ES7: Uncaught TypeError: Cannot read property ...
I'm getting this error Uncaught TypeError: Cannot read property 'state' of undefined whenever I type anything in the input box of AuthorForm ...
Read more >What is "TypeError: Cannot read property 'state' of undefined"?
The error message says that you don't have the state property on an undefined object. To decode this, we have to understand the...
Read more >Cannot read property 'state' of undefined in ReactJS
When the variable is not defined, JavaScript can not read the undefined variable or property. A similar issue we can find in React...
Read more >Cannot read property when passing in a prop-Reactjs
TypeError : Cannot read property 'name"' of undefined in react when passing object in useState · Got a little bit of a problem...
Read more >TypeError: Cannot read property state of undefined - Michael S
It means that this.state is 'undefined', therefore I just put 'this.state' on console.log and check what comes out. 2. console.log(this.state)
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
In other words if you opened the source code for informeds
Text
you would see that its wrapped inasField
. TheBasicText
is not! therefore what your code is doing is creating two fields with the same name causing informed to freak out because it does this: 1. Deregister the fieldcode
2. Deregister the fieldcode
… “AHHH THERE IS NO FIELD CODE” 😃Create a code sandbox. Prob doing something similar.