-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(common): Improve shorthand array handling
This updates the createShorthand factory to take two special props as extraProps to generate a key if missing. This is necessary for shorthand props that are arrays. The props are: - childKey - enables explicitly setting the key via props - getChildKey - function that takes the given props and returns a key This also fixes some issues I noticed using the menu `items` shorthand prop: - Use the createShorthand factory to create a MenuItem for each item. - Do not infer activeIndex from the items array on mount. Regarding the second point, there were a few issues with it: - The array items may not be objects - they could be primitives or elements - You should be able to reliably set the activeIndex or defaultActiveIndex via props, but this would overwrite that.
- Loading branch information
Showing
3 changed files
with
52 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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