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.

Cannot read "props" of undefined (formless field)

See original GitHub issue

Environment

  • react-advanaced-form: 1.6.4

What

Current behavior

When rendering a field without a parent Form, it will throw the mentioned exception in the console.

Expected behavior

Ideally, #216, yet for now need to add a better explanation of what the error is about.

  • Whenever a field is created without a Form passed to it through the context, a meaningful error must be displayed in the console
  • The rendering of the page must not be blocked; formless field returns null from its render method.

Why

Need to have good DX, errors must be transparent.

How

  1. Check this.context.form upon Field mount.
  2. If undefined, throw a verbose error, prevent from attempting to register.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
redraushancommented, Jan 24, 2019

Sure, let me confirm the same if it works then we cam move to other issues after closing it.

1reaction
kettanaitocommented, Jan 24, 2019

No worries. Glad it cleared it out for you.

There is a React Advanced Form Discord channel for communication. You are welcome to stop by.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React TypeError: Cannot read property 'props' of undefined
The "Cannot read property 'props' of undefined" error occurs when a class method is called without having the correct context bound to the...
Read more >
React - TypeError: Cannot read property 'props' of undefined
I'm trying to create a click event be able to delete an item on my list, but when I click it I get...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
Bug: Cannot read property 'active' of undefined #186 - GitHub
I am trying to use a slider component in my form and a conditional field which is based on the field which is...
Read more >
TypeError: Cannot read property 'props' of undefined (Example)
TypeError : Cannot read property 'props' of undefined ... According to the compiler, props does not exist. However, through the Player SFC, ...
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