Merged
Conversation
Allow the consumer to provide an optional `container` prop. This prop is the same type as the `component` prop and behaves the same way. The `container` prop is a way for consumers to control the way each child of the Cartesian component may look. I anticipate this being used primarily for spacing and layout, when the product of the cartesian component does not have any opinions about its container.
since the container is now the outermost child, it needs the key.
johno
reviewed
Jun 23, 2018
Member
johno
left a comment
There was a problem hiding this comment.
Thanks for the PR! Would definitely like to support this.
I left one comment for a potential small change. Aside from that lgtm ✨
| const combinations = cartesianProduct(props) | ||
| const Component = component | ||
|
|
||
| if (container) { |
Member
There was a problem hiding this comment.
Should we default container to Fragment so we only have one path for rendering?
Contributor
Author
There was a problem hiding this comment.
great thinking. updated.
by defaulting the container prop to `Fragment`, we eliminate a set of possibilities and a [branch in the code](c8r#197 (comment)).
Contributor
Author
|
additionally, I'll add some coverage for this case. |
Contributor
Author
Member
|
Thanks! |
Contributor
Author
|
released in v1.0.46! any thoughts on docs? I'm happy to add it if you'd like |
Member
|
If you wanted to add a props table with descriptions/types that'd be great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Allow the consumer to provide an optional
containerprop. This prop is the same type as thecomponentprop and behaves the same way. Thecontainerprop is a way for consumers to control the way each child of the Cartesian component may look. I anticipate this being used primarily for spacing and layout, when the product of the cartesian component does not have any opinions about its container.I ran into this need here:
I desired this output, and in order to get it I have to be allowed inside of
Cartesian's.mapfn. The only way I can see is the pass a prop:Any interest in adding something like this? as far as I can tell there's no way to do it from user-land as it currently stands.