question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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

Edit on CodeSandbox

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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
yesmeckcommented, Aug 9, 2018

I’ve tried downloading your codesandbox and built it, have no luck to reproduce the error.

1reaction
frostoncommented, Aug 30, 2018

@marswong I could fix it by using ref instead. And then this.customForm.form

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found