Impossible to have form components on second level?
See original GitHub issueI 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:
- Created 8 years ago
- Comments:5
Top 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 >
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
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.
It’s not really documented. I figured it out by reading the code.