[Form] wrappedComponentRef returns undefined in production build
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Version
3.8.0
Environment
Chrome 67, Windows 10
Reproduction link
Steps to reproduce
Cannot reproduce it in dev enviroment. It only happens in production build!! Using create-react-app with react-app-rewired.
What is expected?
Beign able to access all the Form
functions thru wrappedComponentRef
.
What is actually happening?
TypeError: Cannot read property 'props' of undefined.
when calling this.wrappedForm.props.form.validateFields()
The value of wrappedComponentRef
is always undefined
so I can’t access the props.
Note it only happens in production build. In dev everythings works perfectly. Any thoughts what could be the problem? Thanks a lot!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:11 (5 by maintainers)
Top Results From Across the Web
wrappedComponentRef is undefined - React Ant Design ...
The problem is that in the constructor the ref this.form is undefined, but if the modal is open and OK button is clicked...
Read more >How to Read React Errors (fix 'Cannot read property of ...
First order of business is to figure out where the error is. If you're using Create React App, it probably threw up a...
Read more >React Ant Design, Form Component-Reactjs
Coding example for the question wrappedComponentRef is undefined - React Ant Design, Form Component-Reactjs.
Read more >react typeerror: cannot read property 'getfielddecorator' of undefined
wrappedForm.props.form.validateFields() The value of wrappedComponentRef is always undefined so I can't access the props. 报错:Cannot read property ...
Read more >Deal with Undefined 'this' in React Event Handlers Correctly
When teaching React to developers, one thing that comes up often is dealing with a common error. In this post, learn how to...
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 FreeTop 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
Top GitHub Comments
I’ve tried downloading your codesandbox and built it, have no luck to reproduce the error.
@marswong I could fix it by using
ref
instead. And thenthis.customForm.form