Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: small v3 fixes #69

Closed
wants to merge 2 commits into from

Conversation

alexpchin
Copy link
Contributor

feat: ensuring that children is not undefined

@PedroBern
Copy link
Owner

@alexpchin thanks for the PR, but not sure about the need of this. The definition of children is:

 children: React.ReactElement[]

Here.

The children are always an array because I didn't see a use-case where we don't have children, or we have only one child. If children are not provided, there is no screen to be rendered. And if we have only one child, there is no need for tabs. Perhaps I'm missing something?

@PedroBern
Copy link
Owner

PedroBern commented Jan 30, 2021

What do you think about throwing an error in case we have only one or zero children?

@alexpchin
Copy link
Contributor Author

So whilst unlikely, you might have a scenario where you only have one tab and even more unlikely, undefined.

For example, if you used tabs for a profile page, but a certain user type only had one tab, this would not be an array. It would be more work to create two pages that dealt differently with the header and tabs.

Regarding the undefined, this is really, really unlikely. However, when developing perhaps we throw an error that is more helpful rather than just a crash?

@PedroBern
Copy link
Owner

PedroBern commented Jan 30, 2021

Yes, I see your point, I agree. I did some changes on #74, let me know your thought.

@PedroBern
Copy link
Owner

Closing in favor of #74

@PedroBern PedroBern closed this Jan 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants