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.

Impossible to have form components on second level?

See original GitHub issue

I realize my question is unclear, I couldn’t figure out how to properly explain what I mean in a concise way. Here’s what I mean:

<Formsy.Form>
    <div>
        <MyOwnInput />
    </div>
    <button>Submit</button>
</Formsy.Form>

I am unsure if it is only the way I set up formsy and my project, but this won’t work. I’ll get this as undefined in MyOwnInput’s render method.

Is this known and a requirement of formsy-react that every component need to have Formsy.Form as a direct parent?`

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
clayne11commented, Dec 2, 2015

Formsy uses the context to pass down attachToForm / detachFromForm to its children. As long as the context chain doesn’t get broken you can put form children as deeply down the render tree as you’d like.

One thing to be aware of is that if any component in the tree returns false from shouldComponentUpdate, then it’s children will not receive context updates.

0reactions
clayne11commented, Jan 20, 2016

It’s not really documented. I figured it out by reading the code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dividing a form into multiple components with validation
I know that a form cannot be split into components loaded with the router. It is also possible that it cannot "find" items...
Read more >
How to structure a web form - Learn web development | MDN
You now have all the knowledge you'll need to properly structure your web forms. We will cover many of the features introduced here...
Read more >
Forms in HTML documents - W3C
An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, etc.), and...
Read more >
Is it possible to share state between multiple form components?
Filing in all the inputs seems to work fine, data gets added to the components local state, then send to the parent form...
Read more >
Working with Forms in React - SitePoint
Learn the basics of using forms in React: how to allow users to add or edit info, and how to work with input...
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