-
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 handle setting key - If the key is set, leaves it as-is - If the childKey prop is a string/number it uses childKey as the key - If the childKey prop is a function it called childKey with props and uses the return value as the 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
49 additions
and
53 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