Conditional Rendering inside Form
See original GitHub issueI have scenario where i have Form with coditional FormGroups inside like that:
const [isEdit] = useState(false);
And Component return looks more than less like that:
return
<Form>
<FormGroup/>
{isEdit && <FormGroup/>}
<FormGroup/>
</Form>
Error from compiler is:

TS2322
Please adjust Childern type for Form also to be false | React.ReactElement
Today workarround for this would be:
return
<Form>
<FormGroup/>
{(isEdit && <FormGroup/>) as ReactElement}
<FormGroup/>
</Form>
to:
children: false | ReactElement | ReactElement[];
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Conditional form rendering in react - Stack Overflow
Conditional form rendering in react · Which is your select box component that you want to show on based of this. · x01...
Read more >Conditional Rendering - React
Conditional rendering in React works the same way conditions work in JavaScript. Use JavaScript operators like if or the conditional operator to create...
Read more >Six methods to achieve conditional rendering in React - Flexiple
In this article, we'll be discussing conditional rendering in ReactJS and looking at different ways to handle those cases.
Read more >7 Ways to Implement Conditional Rendering in React ...
Conditional rendering is a term to describe the ability to render different user interface (UI) markup if a condition is true or false....
Read more >How do you do conditional rendering in React?
Conditional rendering is about displaying style or HTML depending on your React state. In other words, we are adding logic and conditionals ...
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

@Lukas742 Please, same for FormGroup. Currently i get even error with workarround FromGroup where we have ReactNode. It tries to render “false”…
🎉 This issue has been resolved in version v0.27.4 🎉
The release is available on v0.27.4
Your semantic-release bot 📦🚀