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

Add event to toggle handlers #40

Closed
wants to merge 2 commits into from
Closed

Conversation

Nicktho
Copy link

@Nicktho Nicktho commented Jul 9, 2021

Hi there, great library!

I have a use case for handling the click event of the hamburger component. I've gone ahead and suggested a way to incorporate it into the api, as a second argument to toggle and onToggled, let me know what you think!

@luukdv
Copy link
Collaborator

luukdv commented Jul 12, 2021

Thanks for the PR! I was actually planning on removing onToggle in 3.0, in favor of:

useEffect(() => {}, [toggled])

Besided that, a few questions about this PR:

  • Can you explain a little bit about the use case?
  • How would you use/read the second variable (the click event) in this typical setup?
const [toggled, toggle] = useState(false)

<Hamburger toggled={toggled} toggle={toggle} />

@luukdv
Copy link
Collaborator

luukdv commented Aug 9, 2021

Closing due to inactivity.

@luukdv luukdv closed this Aug 9, 2021
@JaapWeijland
Copy link

Just wanted to drop by saying that I need the click event to stop propagation. I know asking for something without contributing is not really the nicest thing to do, but this may help you prioritise new features.

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.

3 participants