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(Dropdown): add managed state support for children #2807

Closed
wants to merge 1 commit into from
Closed

feat(Dropdown): add managed state support for children #2807

wants to merge 1 commit into from

Conversation

sinangun
Copy link

Managed state support added for Dropdown's Dropdown.Item children.

@welcome
Copy link

welcome bot commented May 18, 2018

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to run the doc site locally and try a few pages, ensuring everything is in good working order.
  • Include tests when adding/changing behavior.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@levithomason
Copy link
Member

Thank you for the PR. We want to avoid inspecting children, however, as it is brittle and leads to unexpected behavior. Example, a user can wrap an DropdownItem in an HOC for navigation purposes and we would no longer be able to handle that case even though it is valid usage.

Our preferred solution is to extend the capabilities of the shorthand that the dropdown handles to enable more use cases, see #1757. Also #889.

Our solution to allowing the user to control children entirely and have access to the state of the dropdown is to use a render function pattern. We've extended the factories to allow functions, #2790. This means you can now have access to the computed state of the Dropdown menu while explicitly defining the menu as JSX.

More examples and docs to come.

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