Matt Miller
May 5, 2022

The "hook" prop being optional seems like it would violate React's "rules of hooks" pattern. Technically, if you were to do something like `hook={someCondition ? { expanded, toggle } : undefined}` then the `useAccordion()` hook would be fired nondeterministically, i.e. on some renders of `Accordion` it will be called and in other renders it will not

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Matt Miller
Matt Miller

Responses (2)

Write a response